diff options
author | nicm <nicm> | 2014-10-08 17:35:58 +0000 |
---|---|---|
committer | nicm <nicm> | 2014-10-08 17:35:58 +0000 |
commit | a27ba6e38006c12c48de88600b8cff9f6aabfed7 (patch) | |
tree | fc8ecf1c1b965f70b95d0a3e472cd0b1a2e1d2c9 /utf8.c | |
parent | 77efcf8bdd14cd19dc445cf6e44bba7af414939c (diff) |
Add xreallocarray and remove nmemb argument from xrealloc.
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -419,7 +419,7 @@ utf8_fromcstr(const char *src) n = 0; while (*src != '\0') { - dst = xrealloc(dst, n + 1, sizeof *dst); + dst = xreallocarray(dst, n + 1, sizeof *dst); if (utf8_open(&dst[n], *src)) { more = 1; while (*++src != '\0' && more) @@ -436,7 +436,7 @@ utf8_fromcstr(const char *src) n++; } - dst = xrealloc(dst, n + 1, sizeof *dst); + dst = xreallocarray(dst, n + 1, sizeof *dst); dst[n].size = 0; return (dst); } @@ -452,12 +452,12 @@ utf8_tocstr(struct utf8_data *src) n = 0; for(; src->size != 0; src++) { - dst = xrealloc(dst, n + src->size, 1); + dst = xreallocarray(dst, n + src->size, 1); memcpy(dst + n, src->data, src->size); n += src->size; } - dst = xrealloc(dst, n + 1, 1); + dst = xreallocarray(dst, n + 1, 1); dst[n] = '\0'; return (dst); } |