diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-07-09 11:33:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-07-09 11:33:28 -0700 |
commit | e91ae32a01ffe294b8510c1d8cd7138493a0712f (patch) | |
tree | 461b9dacf6c1e8adf5f59251af093dc7c407091f /parse-options.c | |
parent | line-log: use commit_list_append() instead of duplicating its code (diff) | |
parent | http-push: refactor parsing of remote object names (diff) | |
download | tgif-e91ae32a01ffe294b8510c1d8cd7138493a0712f.tar.xz |
Merge branch 'jk/skip-prefix'
* jk/skip-prefix:
http-push: refactor parsing of remote object names
imap-send: use skip_prefix instead of using magic numbers
use skip_prefix to avoid repeated calculations
git: avoid magic number with skip_prefix
fetch-pack: refactor parsing in get_ack
fast-import: refactor parsing of spaces
stat_opt: check extra strlen call
daemon: use skip_prefix to avoid magic numbers
fast-import: use skip_prefix for parsing input
use skip_prefix to avoid repeating strings
use skip_prefix to avoid magic numbers
transport-helper: avoid reading past end-of-string
fast-import: fix read of uninitialized argv memory
apply: use skip_prefix instead of raw addition
refactor skip_prefix to return a boolean
avoid using skip_prefix as a boolean
daemon: mark some strings as const
parse_diff_color_slot: drop ofs parameter
Diffstat (limited to 'parse-options.c')
-rw-r--r-- | parse-options.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/parse-options.c b/parse-options.c index b536896f26..e7dafa80d5 100644 --- a/parse-options.c +++ b/parse-options.c @@ -231,7 +231,8 @@ static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg, continue; again: - rest = skip_prefix(arg, long_name); + if (!skip_prefix(arg, long_name, &rest)) + rest = NULL; if (options->type == OPTION_ARGUMENT) { if (!rest) continue; @@ -280,12 +281,13 @@ is_abbreviated: continue; } flags |= OPT_UNSET; - rest = skip_prefix(arg + 3, long_name); - /* abbreviated and negated? */ - if (!rest && starts_with(long_name, arg + 3)) - goto is_abbreviated; - if (!rest) - continue; + if (!skip_prefix(arg + 3, long_name, &rest)) { + /* abbreviated and negated? */ + if (starts_with(long_name, arg + 3)) + goto is_abbreviated; + else + continue; + } } if (*rest) { if (*rest != '=') |