diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-04-11 19:45:26 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-04-11 19:45:26 +0200 |
commit | 6642b2b2bf3d16e0632989c1e29c672882e0d283 (patch) | |
tree | f39581ab909a41fe07c005cbb81f2ec273d057ea /lib/src/split_argv.c | |
parent | 71d98c150f6242fcf1b8a5845e46db56caad3885 (diff) |
Don't pre-allocate argument vector for command lines
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'lib/src/split_argv.c')
-rw-r--r-- | lib/src/split_argv.c | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/lib/src/split_argv.c b/lib/src/split_argv.c index b95720d..5930e2d 100644 --- a/lib/src/split_argv.c +++ b/lib/src/split_argv.c @@ -80,25 +80,3 @@ fail_str: errno = EINVAL; return -1; } - -char **split_argv(char *str) -{ - char **argv = NULL; - int i, count; - - count = pack_argv(str); - if (count <= 0) - return NULL; - - argv = malloc(sizeof(argv[0]) * (count + 1)); - if (argv == NULL) - return NULL; - - for (i = 0; i < count; ++i) { - argv[i] = str; - str += strlen(str) + 1; - } - - argv[i] = NULL; - return argv; -} |