diff options
| author | Junio C Hamano <gitster@pobox.com> | 2018-11-18 18:23:53 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-11-18 18:23:53 +0900 |
| commit | ab96f28ba4deb71ff64b31bd63cee96314db7112 (patch) | |
| tree | 16ad5cafd201b65eb74c0c132f08b5ecc852fd92 /builtin/notes.c | |
| parent | Merge branch 'jk/curl-ldflags' (diff) | |
| parent | midx: double-check large object write loop (diff) | |
| download | git-ab96f28ba4deb71ff64b31bd63cee96314db7112.tar.gz git-ab96f28ba4deb71ff64b31bd63cee96314db7112.zip | |
Merge branch 'jk/unused-parameter-fixes'
Various functions have been audited for "-Wunused-parameter" warnings
and bugs in them got fixed.
* jk/unused-parameter-fixes:
midx: double-check large object write loop
assert NOARG/NONEG behavior of parse-options callbacks
parse-options: drop OPT_DATE()
apply: return -1 from option callback instead of calling exit(1)
cat-file: report an error on multiple --batch options
tag: mark "--message" option with NONEG
show-branch: mark --reflog option as NONEG
format-patch: mark "--no-numbered" option with NONEG
status: mark --find-renames option with NONEG
cat-file: mark batch options with NONEG
pack-objects: mark index-version option as NONEG
ls-files: mark exclude options as NONEG
am: handle --no-patch-format option
apply: mark include/exclude options as NONEG
Diffstat (limited to 'builtin/notes.c')
| -rw-r--r-- | builtin/notes.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/notes.c b/builtin/notes.c index c05cd004ab..91faa514aa 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -215,6 +215,8 @@ static int parse_msg_arg(const struct option *opt, const char *arg, int unset) { struct note_data *d = opt->value; + BUG_ON_OPT_NEG(unset); + strbuf_grow(&d->buf, strlen(arg) + 2); if (d->buf.len) strbuf_addch(&d->buf, '\n'); @@ -229,6 +231,8 @@ static int parse_file_arg(const struct option *opt, const char *arg, int unset) { struct note_data *d = opt->value; + BUG_ON_OPT_NEG(unset); + if (d->buf.len) strbuf_addch(&d->buf, '\n'); if (!strcmp(arg, "-")) { @@ -250,6 +254,8 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset) enum object_type type; unsigned long len; + BUG_ON_OPT_NEG(unset); + if (d->buf.len) strbuf_addch(&d->buf, '\n'); @@ -273,6 +279,7 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset) static int parse_reedit_arg(const struct option *opt, const char *arg, int unset) { struct note_data *d = opt->value; + BUG_ON_OPT_NEG(unset); d->use_editor = 1; return parse_reuse_arg(opt, arg, unset); } |
