]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - string.c
create_argv_offset(): Use arr_zalloc().
[paraslash.git] / string.c
index 46b346235f17ffb696f43d22d3dcfde4c75ba4ca..423fd296bde6dc12d0ce6c042a7a5d674913eaa2 100644 (file)
--- a/string.c
+++ b/string.c
@@ -739,13 +739,11 @@ void free_argv(char **argv)
 static int create_argv_offset(int offset, const char *buf, const char *delim,
                char ***result)
 {
-       char *word, **argv = arr_alloc(offset + 1, sizeof(char *));
+       char *word, **argv = arr_zalloc(offset + 1, sizeof(char *));
        const char *p;
        int i, ret;
 
-       for (i = 0; i < offset; i++)
-               argv[i] = NULL;
-       for (p = buf; p && *p; p += ret, i++) {
+       for (p = buf, i = offset; p && *p; p += ret, i++) {
                ret = get_next_word(p, delim, &word);
                if (ret < 0)
                        goto err;