diff options
author | Dimitri Staessens <dimitri.staessens@ugent.be> | 2018-03-16 13:07:14 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-03-16 13:38:06 +0100 |
commit | 67729ef3efaa7925816a82688744c8c5c29f4ce3 (patch) | |
tree | c2ef20f4fbe829fdd7354ad2d11d0fc3c72a9bdb /src | |
parent | 4e775400564cc02b51978dc2671c126ff8da5e9d (diff) | |
download | ouroboros-67729ef3efaa7925816a82688744c8c5c29f4ce3.tar.gz ouroboros-67729ef3efaa7925816a82688744c8c5c29f4ce3.zip |
lib: Simplify some code in rdrbuff
This simplifies some functions in the rdrbuff.
Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/shm_rdrbuff.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c index d1ad5a3b..6e3dbca4 100644 --- a/src/lib/shm_rdrbuff.c +++ b/src/lib/shm_rdrbuff.c @@ -517,7 +517,6 @@ ssize_t shm_rdrbuff_read(uint8_t ** dst, struct shm_rdrbuff * rdrb, size_t idx) { - ssize_t len = 0; struct shm_du_buff * sdb; assert(dst); @@ -525,23 +524,18 @@ ssize_t shm_rdrbuff_read(uint8_t ** dst, assert(idx < (SHM_BUFFER_SIZE)); sdb = idx_to_du_buff_ptr(rdrb, idx); - len = (ssize_t) (sdb->du_tail - sdb->du_head); *dst = ((uint8_t *) (sdb + 1)) + sdb->du_head; - return len; + return (ssize_t) (sdb->du_tail - sdb->du_head); } struct shm_du_buff * shm_rdrbuff_get(struct shm_rdrbuff * rdrb, size_t idx) { - struct shm_du_buff * sdb; - assert(rdrb); assert(idx < (SHM_BUFFER_SIZE)); - sdb = idx_to_du_buff_ptr(rdrb, idx); - - return sdb; + return idx_to_du_buff_ptr(rdrb, idx); } int shm_rdrbuff_remove(struct shm_rdrbuff * rdrb, |