aboutsummaryrefslogtreecommitdiffstats
path: root/parse-options.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-07-05 16:44:47 -0400
committerJunio C Hamano <gitster@pobox.com>2016-07-06 10:11:08 -0700
commit023ff39b2994804e4a7b2274b22336bdb37d4a54 (patch)
tree961ed842c71e0b8ba81b00b1212f613fd759c781 /parse-options.h
parent0b65a8dbdb38962e700ee16776a3042beb489060 (diff)
downloadgit-023ff39b2994804e4a7b2274b22336bdb37d4a54.tar.gz
parse_options: allocate a new array when concatenating
In exactly one callers (builtin/revert.c), we build up the options list dynamically from multiple arrays. We do so by manually inserting "filler" entries into one array, and then copying the other array into the allocated space. This is tedious and error-prone, as you have to adjust the filler any time the second array is modified (although we do at least check and die() when the counts do not match up). Instead, let's just allocate a new array. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.h')
-rw-r--r--parse-options.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse-options.h b/parse-options.h
index ea4af92a51..78f8384c56 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -215,7 +215,7 @@ extern int parse_options_step(struct parse_opt_ctx_t *ctx,
extern int parse_options_end(struct parse_opt_ctx_t *ctx);
-extern int parse_options_concat(struct option *dst, size_t, struct option *src);
+extern struct option *parse_options_concat(struct option *a, struct option *b);
/*----- some often used options -----*/
extern int parse_opt_abbrev_cb(const struct option *, const char *, int);