# HG changeset patch # User Matti Hamalainen # Date 1525961736 -10800 # Node ID 761724e01c020d71a27773851b84aeb0af104794 # Parent b5cd85983039a7b8bbcb3e92f9da86eb63ebf831 Cleanups. diff -r b5cd85983039 -r 761724e01c02 th_datastruct.c --- a/th_datastruct.c Thu May 10 16:04:15 2018 +0300 +++ b/th_datastruct.c Thu May 10 17:15:36 2018 +0300 @@ -415,16 +415,15 @@ } -BOOL th_growbuf_grow(th_growbuf_t *buf, const size_t grow) +BOOL th_growbuf_grow(th_growbuf_t *buf, const size_t amount) { if (buf == NULL) return FALSE; - if (buf->data == NULL || buf->len + grow >= buf->size) + if (buf->data == NULL || buf->len + amount >= buf->size) { - buf->size += grow + (buf->mingrow > 0 ? buf->mingrow : TH_BUFGROW); - buf->data = (uint8_t *) th_realloc(buf->data, buf->size); - if (buf->data == NULL) + buf->size += amount + (buf->mingrow > 0 ? buf->mingrow : TH_BUFGROW); + if ((buf->data = th_realloc(buf->data, buf->size)) == NULL) return FALSE; } return TRUE; @@ -459,15 +458,15 @@ } -BOOL th_growbuf_put_str(th_growbuf_t *buf, const void *s, const size_t len) +BOOL th_growbuf_put_str(th_growbuf_t *buf, const void *str, const size_t len) { - if (s == NULL) + if (str == NULL) return FALSE; if (!th_growbuf_grow(buf, len + 1)) return FALSE; - memcpy(buf->data + buf->len, s, len + 1); + memcpy(buf->data + buf->len, str, len + 1); buf->len += len; return TRUE;