X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fstr_talloc%2Fstr_talloc.c;h=3bcb1f2a9cf3f7836603bfa9cbed7524f98c87ff;hp=e2d12df8791942744f3dec63f2e9a18284198a4d;hb=b30c544bd1486e7b60b99259e3d0dcbc1ec9efd0;hpb=fa64b4599366818ea546c7db026f37d987d181a8 diff --git a/ccan/str_talloc/str_talloc.c b/ccan/str_talloc/str_talloc.c index e2d12df8..3bcb1f2a 100644 --- a/ccan/str_talloc/str_talloc.c +++ b/ccan/str_talloc/str_talloc.c @@ -11,8 +11,7 @@ #include #include -char **strsplit(const void *ctx, const char *string, const char *delims, - unsigned int *nump) +char **strsplit(const void *ctx, const char *string, const char *delims) { char **lines = NULL; unsigned int max = 64, num = 0; @@ -30,9 +29,9 @@ char **strsplit(const void *ctx, const char *string, const char *delims, lines = talloc_realloc(ctx, lines, char *, max*=2 + 1); } lines[num] = NULL; - if (nump) - *nump = num; - return lines; + + /* Shrink, so talloc_get_size works */ + return talloc_realloc(ctx, lines, char *, num+1); } char *strjoin(const void *ctx, char *strings[], const char *delim)