From e2314f0f5e80c434978ecdf5cd084c29ee673e35 Mon Sep 17 00:00:00 2001 From: skarg Date: Tue, 7 Sep 2010 16:17:25 +0000 Subject: [PATCH] Fixed compiler warning (compiled with IAR) --- bacnet-stack/src/fifo.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bacnet-stack/src/fifo.c b/bacnet-stack/src/fifo.c index bf8d005e..c80474ea 100755 --- a/bacnet-stack/src/fifo.c +++ b/bacnet-stack/src/fifo.c @@ -52,7 +52,15 @@ unsigned FIFO_Count( FIFO_BUFFER const *b) { - return (b ? (b->head - b->tail) : 0); + unsigned head, tail; /* used to avoid volatile decision */ + + if (b) { + head = b->head; + tail = b->tail; + return head-tail; + } else { + return 0; + } } /****************************************************************************