summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: abd68b5)
raw | patch | inline | side by side (parent: abd68b5)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 23 Jun 2010 02:23:35 +0000 (22:23 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 23 Jun 2010 02:53:45 +0000 (22:53 -0400) |
tig.c | patch | blob | history |
index a82a4686e4696316a00eeb9473d8deb934df6e4b..e2e83ff8fb320acb494796479f5288eb7e5d6e71 100644 (file)
--- a/tig.c
+++ b/tig.c
argv[0] = NULL;
}
+static size_t
+argv_size(const char **argv)
+{
+ int argc = 0;
+
+ while (argv && argv[argc])
+ argc++;
+
+ return argc;
+}
+
DEFINE_ALLOCATOR(argv_realloc, const char *, SIZEOF_ARG)
static bool
argv_append(const char ***argv, const char *arg)
{
- int argc = 0;
-
- while (*argv && (*argv)[argc])
- argc++;
+ size_t argc = argv_size(*argv);
if (!argv_realloc(argv, argc, 2))
return FALSE;