]> git.ozlabs.org Git - ccan/blobdiff - tools/namespacize.c
tools: avoid needless post increment on size
[ccan] / tools / namespacize.c
index 545b28bb1a4f7d2dcd138b9a4fe9325907b81502..cf6bc26d7c4983a8d3483c976ecb9428ad8ebaac 100644 (file)
@@ -53,7 +53,8 @@ static char **get_dir(const char *dir)
                names[size++]
                        = talloc_asprintf(names, "%s/%s", dir, ent->d_name);
        }
-       names[size++] = NULL;
+       /* FIXME: if the loop doesn't run at least once, we'll segfault here */
+       names[size] = NULL;
        closedir(d);
        return names;
 }
@@ -445,7 +446,7 @@ static struct replace *read_replacement_file(const char *depdir)
                return NULL;
        }
 
-       for (line = strsplit(file, file, "\n", NULL); *line; line++)
+       for (line = strsplit(file, file, "\n"); *line; line++)
                add_replace(&repl, *line);
        return repl;
 }