From de2911076c8d075827bc8401fd0196a086953137 Mon Sep 17 00:00:00 2001 From: idgay Date: Thu, 8 Feb 2007 17:49:22 +0000 Subject: [PATCH] fix empty queue case --- tos/system/RoundRobinResourceQueueC.nc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tos/system/RoundRobinResourceQueueC.nc b/tos/system/RoundRobinResourceQueueC.nc index b6d5565b..d2805a64 100644 --- a/tos/system/RoundRobinResourceQueueC.nc +++ b/tos/system/RoundRobinResourceQueueC.nc @@ -36,9 +36,12 @@ generic module RoundRobinResourceQueueC(uint8_t size) { } } implementation { - enum {NO_ENTRY = 0xFF}; + enum { + NO_ENTRY = 0xFF, + SIZE = size ? (size - 1) / 8 + 1 : 0 + }; - uint8_t resQ[(size-1)/8 + 1]; + uint8_t resQ[SIZE]; uint8_t last = 0; void clearEntry(uint8_t id) { -- 2.39.2