X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fstr_talloc%2Fstr_talloc.c;h=3bcb1f2a9cf3f7836603bfa9cbed7524f98c87ff;hb=02d83e6adfd34fe62aa4fe2bc4dbc3c4a13bd5f6;hp=e2d12df8791942744f3dec63f2e9a18284198a4d;hpb=fa64b4599366818ea546c7db026f37d987d181a8;p=ccan 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)