diff options
author | inmarket <andrewh@inmarket.com.au> | 2014-03-24 10:07:02 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2014-03-24 10:07:02 +1000 |
commit | c7566aa5531b35a84f06940966f31acadfc85ade (patch) | |
tree | 84557e2b02ba7466ca8d65091e5a33e6e27e7f3d /src/gqueue/gqueue.c | |
parent | 56b416708c458489bd37314bd94e2a0cbb7e6434 (diff) | |
download | uGFX-c7566aa5531b35a84f06940966f31acadfc85ade.tar.gz uGFX-c7566aa5531b35a84f06940966f31acadfc85ade.tar.bz2 uGFX-c7566aa5531b35a84f06940966f31acadfc85ade.zip |
Add some safety parameter checking to queueing
Diffstat (limited to 'src/gqueue/gqueue.c')
-rw-r--r-- | src/gqueue/gqueue.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gqueue/gqueue.c b/src/gqueue/gqueue.c index 1b2d4618..8540bcea 100644 --- a/src/gqueue/gqueue.c +++ b/src/gqueue/gqueue.c @@ -64,6 +64,7 @@ void _gqueueDeinit(void) gfxSystemUnlock(); } void gfxQueueASyncPutI(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem) { + if (!pitem) return; // Safety pitem->next = 0; if (!pqueue->head) { pqueue->head = pqueue->tail = pitem; @@ -79,6 +80,7 @@ void _gqueueDeinit(void) gfxSystemUnlock(); } void gfxQueueASyncPushI(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem) { + if (!pitem) return; // Safety pitem->next = pqueue->head; pqueue->head = pitem; if (!pitem->next) @@ -93,8 +95,7 @@ void _gqueueDeinit(void) void gfxQueueASyncRemoveI(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem) { gfxQueueASyncItem *pi; - if (!pitem) - return; + if (!pitem) return; // Safety if (pqueue->head) { if (pqueue->head == pitem) { pqueue->head = pitem->next; @@ -175,6 +176,7 @@ void _gqueueDeinit(void) gfxSystemUnlock(); } void gfxQueueGSyncPutI(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem) { + if (!pitem) return; // Safety pitem->next = 0; if (!pqueue->head) { pqueue->head = pqueue->tail = pitem; @@ -191,6 +193,7 @@ void _gqueueDeinit(void) gfxSystemUnlock(); } void gfxQueueGSyncPushI(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem) { + if (!pitem) return; // Safety pitem->next = pqueue->head; pqueue->head = pitem; if (!pitem->next) @@ -206,8 +209,7 @@ void _gqueueDeinit(void) void gfxQueueGSyncRemoveI(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem) { gfxQueueGSyncItem *pi; - if (!pitem) - return; + if (!pitem) return; // Safety if (pqueue->head) { if (pqueue->head == pitem) { pqueue->head = pitem->next; @@ -276,6 +278,7 @@ void _gqueueDeinit(void) } bool_t gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms) { + if (!pitem) return; // Safety gfxSemInit(&pitem->sem, 0, 1); pitem->next = 0; @@ -294,6 +297,7 @@ void _gqueueDeinit(void) } bool_t gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms) { + if (!pitem) return; // Safety gfxSemInit(&pitem->sem, 0, 1); gfxSystemLock(); @@ -311,9 +315,7 @@ void _gqueueDeinit(void) void gfxQueueFSyncRemove(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem) { gfxQueueFSyncItem *pi; - if (!pitem) - return; - + if (!pitem) return; // Safety gfxSystemLock(); if (pqueue->head) { if (pqueue->head == pitem) { |