From d64f05e8bf1277132b648bda2e1175ad8c1d2d5c Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Mon, 6 Feb 2017 21:48:00 +0100 Subject: ipcpd: Revise PCI manipulation in normal The pci function will store offsets to avoid having to recalculate them every time. TTL handling is removed from the fmgr, the TTL is automatically decreased when deserializing the PCI (or set to 1 if there is no TTL present so the PDU will be forwarded). The deserialisation function now takes a pointer to a struct pci as input to avoid memory allocation and release each time a PDU is processed. Some checks have been replaced with assert() and return values replaced with void where it makes sense. --- src/lib/shm_rdrbuff.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/lib') diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c index ce81d171..55047aa5 100644 --- a/src/lib/shm_rdrbuff.c +++ b/src/lib/shm_rdrbuff.c @@ -619,28 +619,20 @@ uint8_t * shm_du_buff_tail_alloc(struct shm_du_buff * sdb, return buf; } -int shm_du_buff_head_release(struct shm_du_buff * sdb, - size_t size) +void shm_du_buff_head_release(struct shm_du_buff * sdb, + size_t size) { assert(sdb); - - if (size > sdb->du_tail - sdb->du_head) - return -EOVERFLOW; + assert(!(size > sdb->du_tail - sdb->du_head)); sdb->du_head += size; - - return 0; } -int shm_du_buff_tail_release(struct shm_du_buff * sdb, - size_t size) +void shm_du_buff_tail_release(struct shm_du_buff * sdb, + size_t size) { assert(sdb); - - if (size > sdb->du_tail - sdb->du_head) - return -EOVERFLOW; + assert(!(size > sdb->du_tail - sdb->du_head)); sdb->du_tail -= size; - - return 0; } -- cgit v1.2.3