From bae78fb734b9770619d2d7dbc10dcc55fab18085 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sun, 18 Jan 2015 03:20:56 +0100 Subject: sds.h: len/avail: remove unnecessary temp var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the returned value of sdsheader directly in the return call instead of using a temporary variable since we’re not doing pointer arithmetic directly in the sdslen and sdsavail functions anymore. --- src/sds.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sds.h b/src/sds.h index 2d98969..9a2187e 100644 --- a/src/sds.h +++ b/src/sds.h @@ -46,13 +46,11 @@ static inline struct sdshdr * sdsheader(const sds s) { } static inline size_t sdslen(const sds s) { - struct sdshdr *sh = sdsheader(s); - return sh->len; + return sdsheader(s)->len; } static inline size_t sdsavail(const sds s) { - struct sdshdr *sh = sdsheader(s); - return sh->free; + return sdsheader(s)->free; } sds sdsnewlen(const void *init, size_t initlen); -- cgit v1.2.3-70-g09d2