X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=parse-options-cb.c;h=1240a8514e040954cbc7f091e7053b5c76ac6627;hb=37ab8ebef164cc2813658c824561a09dc7cde22f;hp=a3de795c581a3aab084efac75ed2d6edc2535a15;hpb=d7267d55ef03c5b496901e2addf2f0a5da0f9cc3;p=thirdparty%2Fgit.git diff --git a/parse-options-cb.c b/parse-options-cb.c index a3de795c58..1240a8514e 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -159,6 +159,23 @@ int parse_opt_tertiary(const struct option *opt, const char *arg, int unset) return 0; } +struct option *parse_options_dup(const struct option *o) +{ + struct option *opts; + int nr = 0; + + while (o && o->type != OPTION_END) { + nr++; + o++; + } + + ALLOC_ARRAY(opts, nr + 1); + memcpy(opts, o - nr, sizeof(*o) * nr); + memset(opts + nr, 0, sizeof(*opts)); + opts[nr].type = OPTION_END; + return opts; +} + struct option *parse_options_concat(struct option *a, struct option *b) { struct option *ret;