Mercurial > hg > th-libs
changeset 107:f6e0a32b5906
Remove old string growbuf code.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 21 Jun 2014 20:01:36 +0300 |
parents | 4bba5be9d3bf |
children | 87f1caa659d4 |
files | th_string.c th_string.h |
diffstat | 2 files changed, 0 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/th_string.c Sat Jun 21 19:59:54 2014 +0300 +++ b/th_string.c Sat Jun 21 20:01:36 2014 +0300 @@ -569,48 +569,3 @@ return (len == 6) ? val : -1; } - - -BOOL th_growbuf(char **buf, size_t *bufsize, size_t *len, size_t grow) -{ - if (*buf == NULL) - *bufsize = *len = 0; - - if (*buf == NULL || *len + grow >= *bufsize) - { - *bufsize += grow + TH_BUFGROW; - *buf = (char *) th_realloc(*buf, *bufsize); - if (*buf == NULL) - return FALSE; - } - return TRUE; -} - - -BOOL th_vputch(char **buf, size_t *bufsize, size_t *len, const char ch) -{ - if (!th_growbuf(buf, bufsize, len, 1)) - return FALSE; - - (*buf)[*len] = ch; - (*len)++; - - return TRUE; -} - - -BOOL th_vputs(char **buf, size_t *bufsize, size_t *len, const char *str) -{ - size_t slen; - if (str == NULL) - return FALSE; - - slen = strlen(str); - if (!th_growbuf(buf, bufsize, len, slen)) - return FALSE; - - strcpy(*buf + *len, str); - (*len) += slen; - - return TRUE; -}
--- a/th_string.h Sat Jun 21 19:59:54 2014 +0300 +++ b/th_string.h Sat Jun 21 20:01:36 2014 +0300 @@ -79,13 +79,6 @@ int th_get_hex_triplet(const char *); -/* Growing string buffer - */ -BOOL th_growbuf(char **buf, size_t *bufsize, size_t *len, size_t grow); -BOOL th_vputch(char **buf, size_t *bufsize, size_t *len, const char ch); -BOOL th_vputs(char **buf, size_t *bufsize, size_t *len, const char *str); - -#define TH_BUFGROW (32) #ifdef __cplusplus }