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
This commit is contained in:
@ -708,11 +708,14 @@ static int context_callback(const struct option *opt, const char *arg,
|
||||
static int file_callback(const struct option *opt, const char *arg, int unset)
|
||||
{
|
||||
struct grep_opt *grep_opt = opt->value;
|
||||
int from_stdin = !strcmp(arg, "-");
|
||||
int from_stdin;
|
||||
FILE *patterns;
|
||||
int lno = 0;
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
BUG_ON_OPT_NEG(unset);
|
||||
|
||||
from_stdin = !strcmp(arg, "-");
|
||||
patterns = from_stdin ? stdin : fopen(arg, "r");
|
||||
if (!patterns)
|
||||
die_errno(_("cannot open '%s'"), arg);
|
||||
@ -733,6 +736,8 @@ static int file_callback(const struct option *opt, const char *arg, int unset)
|
||||
static int not_callback(const struct option *opt, const char *arg, int unset)
|
||||
{
|
||||
struct grep_opt *grep_opt = opt->value;
|
||||
BUG_ON_OPT_NEG(unset);
|
||||
BUG_ON_OPT_ARG(arg);
|
||||
append_grep_pattern(grep_opt, "--not", "command line", 0, GREP_NOT);
|
||||
return 0;
|
||||
}
|
||||
@ -740,6 +745,8 @@ static int not_callback(const struct option *opt, const char *arg, int unset)
|
||||
static int and_callback(const struct option *opt, const char *arg, int unset)
|
||||
{
|
||||
struct grep_opt *grep_opt = opt->value;
|
||||
BUG_ON_OPT_NEG(unset);
|
||||
BUG_ON_OPT_ARG(arg);
|
||||
append_grep_pattern(grep_opt, "--and", "command line", 0, GREP_AND);
|
||||
return 0;
|
||||
}
|
||||
@ -747,6 +754,8 @@ static int and_callback(const struct option *opt, const char *arg, int unset)
|
||||
static int open_callback(const struct option *opt, const char *arg, int unset)
|
||||
{
|
||||
struct grep_opt *grep_opt = opt->value;
|
||||
BUG_ON_OPT_NEG(unset);
|
||||
BUG_ON_OPT_ARG(arg);
|
||||
append_grep_pattern(grep_opt, "(", "command line", 0, GREP_OPEN_PAREN);
|
||||
return 0;
|
||||
}
|
||||
@ -754,6 +763,8 @@ static int open_callback(const struct option *opt, const char *arg, int unset)
|
||||
static int close_callback(const struct option *opt, const char *arg, int unset)
|
||||
{
|
||||
struct grep_opt *grep_opt = opt->value;
|
||||
BUG_ON_OPT_NEG(unset);
|
||||
BUG_ON_OPT_ARG(arg);
|
||||
append_grep_pattern(grep_opt, ")", "command line", 0, GREP_CLOSE_PAREN);
|
||||
return 0;
|
||||
}
|
||||
@ -762,6 +773,7 @@ static int pattern_callback(const struct option *opt, const char *arg,
|
||||
int unset)
|
||||
{
|
||||
struct grep_opt *grep_opt = opt->value;
|
||||
BUG_ON_OPT_NEG(unset);
|
||||
append_grep_pattern(grep_opt, arg, "-e option", 0, GREP_PATTERN);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user