From: idgay Date: Thu, 8 Feb 2007 17:49:22 +0000 (+0000) Subject: fix empty queue case X-Git-Tag: tinyos/2.0.1~184 X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=commitdiff_plain;h=de2911076c8d075827bc8401fd0196a086953137;p=tinyos-2.x.git fix empty queue case --- 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) {