diff options
author | Keith Packard <keithp@keithp.com> | 2013-11-16 23:34:59 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-01-12 10:14:50 -0800 |
commit | d0339a5c66846c9f14e3b584e34688520a0916ab (patch) | |
tree | c55647a2a55a1f2b8059c09bba0bf772e05dd934 | |
parent | c608560dbbac18837cb00ef0d774a66ea7706534 (diff) |
os: xstrtokenize takes and returns const char * now
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | include/misc.h | 2 | ||||
-rw-r--r-- | os/utils.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/misc.h b/include/misc.h index 17de71041..165d42e85 100644 --- a/include/misc.h +++ b/include/misc.h @@ -246,7 +246,7 @@ padding_for_int32(const int bytes) } -extern char **xstrtokenize(const char *str, const char *separators); +extern const char **xstrtokenize(const char *str, const char *separators); extern void FormatInt64(int64_t num, char *string); extern void FormatUInt64(uint64_t num, char *string); extern void FormatUInt64Hex(uint64_t num, char *string); diff --git a/os/utils.c b/os/utils.c index 608ee6ab0..e81dc5f2d 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1946,10 +1946,10 @@ CheckUserAuthorization(void) * Tokenize a string into a NULL terminated array of strings. Always returns * an allocated array unless an error occurs. */ -char ** +const char ** xstrtokenize(const char *str, const char *separators) { - char **list, **nlist; + const char **list, **nlist; char *tok, *tmp; unsigned num = 0, n; @@ -1977,7 +1977,7 @@ xstrtokenize(const char *str, const char *separators) error: free(tmp); for (n = 0; n < num; n++) - free(list[n]); + free((void *) list[n]); free(list); return NULL; } |