From d519bb6531e4b9c367a9f46f2335d62491e24f20 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Wed, 19 Dec 2012 16:49:02 +0100 Subject: [PATCH] get rid of warnings in utils.{c,h} --- utils.c | 5 +++-- utils.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/utils.c b/utils.c index 681f199..a915336 100644 --- a/utils.c +++ b/utils.c @@ -64,11 +64,12 @@ char *string_append(char *a, const char *b, const char *sep) } -char **string_to_argv(const char *str) +char **string_to_argv(const char *s) { + char *str = strdup(s); char **argv = NULL; char *p = strtok (str, " "); - int n_spaces = 0, i; + int n_spaces = 0; while (p) { argv = realloc (argv, sizeof (char*) * ++n_spaces); diff --git a/utils.h b/utils.h index 72465da..c93479d 100644 --- a/utils.h +++ b/utils.h @@ -10,7 +10,7 @@ char *string_replace(const char *needle, const char *replacement, char *string_append(char *a, const char *b, const char *sep); -char **string_to_argv(const char *str); +char **string_to_argv(const char *s); /* exit with an error message */ void die(char *msg, int exit_value);