summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9d7281d)
raw | patch | inline | side by side (parent: 9d7281d)
author | Jonas Fonseca <jonas.fonseca@savoirfairelinux.com> | |
Wed, 2 Jun 2010 15:58:35 +0000 (11:58 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 3 Jun 2010 01:15:51 +0000 (21:15 -0400) |
tig.c | patch | blob | history |
index bfa88e8c4650bd68d33909ec7797861ff4ff3404..1bf95cda407dbcc43715223558e0c38fa20cdda3 100644 (file)
--- a/tig.c
+++ b/tig.c
argv[0] = NULL;
}
-static void
-argv_copy(const char *dst[], const char *src[])
+static bool
+argv_copy(const char *dst[], const char *src[], bool allocate)
{
int argc;
for (argc = 0; src[argc]; argc++)
- dst[argc] = src[argc];
+ if (!(dst[argc] = allocate ? strdup(src[argc]) : src[argc]))
+ return FALSE;
+ return TRUE;
}
io_prepare(struct io *io, const char *dir, enum io_type type, const char *argv[])
{
io_init(io, dir, type);
- argv_copy(io->argv, argv);
+ argv_copy(io->argv, argv, FALSE);
}
static bool
req->key = key;
req->argv[0] = NULL;
- if (!format_argv(req->argv, argv, FORMAT_NONE))
+ if (!argv_copy(req->argv, argv, TRUE))
return REQ_NONE;
return REQ_NONE + ++run_requests;