From e8df81fdb3ab94977c42a4a0fed082602308f3c6 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 4 Aug 2016 00:19:48 +0100 Subject: add tests for utility string handling --- utils/utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'utils/utils.c') diff --git a/utils/utils.c b/utils/utils.c index 1509a6b09..0ddec8194 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -43,12 +43,14 @@ #include "utils/string.h" #include "utils/utils.h" -/* exported interface documented in utils/utils.h */ +/* exported interface documented in utils/string.h */ char *squash_whitespace(const char *s) { char *c; int i = 0, j = 0; + assert(s != NULL); + c = malloc(strlen(s) + 1); if (c != NULL) { do { @@ -208,7 +210,7 @@ nserror snstrjoin(char **str, size_t *size, char sep, size_t nelm, ...) */ #define BYTESIZE_BUFFER_SIZE 20 -/* exported interface documented in utils/utils.h */ +/* exported interface documented in utils/string.h */ char *human_friendly_bytesize(unsigned long bsize) { static char buffer1[BYTESIZE_BUFFER_SIZE]; static char buffer2[BYTESIZE_BUFFER_SIZE]; -- cgit v1.2.3