summaryrefslogtreecommitdiff
path: root/argv-array.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-04-18 14:08:49 -0700
committerJunio C Hamano <gitster@pobox.com>2012-04-18 16:16:16 -0700
commitfd93d2e60ea66fc3796904ff53ead3ef4755b137 (patch)
treed232fa1ceb208c5e16eff70a4efecb778c7c2e87 /argv-array.h
parent7e52f5660e542cf801e8fc6902a30cc572c13736 (diff)
downloadgit-fd93d2e60ea66fc3796904ff53ead3ef4755b137.tar.gz
argv-array: refactor empty_argv initialization
An empty argv-array is initialized to point to a static empty NULL-terminated array. The original implementation separates the actual storage of the NULL-terminator from the pointer to the list. This makes the exposed type a "const char **", which nicely matches the type stored by the argv-array. However, this indirection means that one cannot use empty_argv to initialize a static variable, since it is not a constant. Instead, we can expose empty_argv directly, as an array of pointers. The only place we use it is in the ARGV_ARRAY_INIT initializer, and it decays to a pointer appropriately there. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'argv-array.h')
-rw-r--r--argv-array.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/argv-array.h b/argv-array.h
index 74dd2b1bc0..c45c698d53 100644
--- a/argv-array.h
+++ b/argv-array.h
@@ -1,7 +1,7 @@
#ifndef ARGV_ARRAY_H
#define ARGV_ARRAY_H
-extern const char **empty_argv;
+extern const char *empty_argv[];
struct argv_array {
const char **argv;