parse_options: allocate a new array when concatenating
commit023ff39b2994804e4a7b2274b22336bdb37d4a54
authorJeff King <peff@peff.net>
Tue, 5 Jul 2016 20:44:47 +0000 (5 16:44 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Jul 2016 17:11:08 +0000 (6 10:11 -0700)
tree961ed842c71e0b8ba81b00b1212f613fd759c781
parent0b65a8dbdb38962e700ee16776a3042beb489060
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>
builtin/revert.c
parse-options-cb.c
parse-options.h