]> git.ipfire.org Git - thirdparty/git.git/blobdiff - parse-options-cb.c
Merge branch 'master' of github.com:vnwildman/git
[thirdparty/git.git] / parse-options-cb.c
index a3de795c581a3aab084efac75ed2d6edc2535a15..1240a8514e040954cbc7f091e7053b5c76ac6627 100644 (file)
@@ -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;