Merge branch 'jk/unused-fixes'

Code clean-up to remove unused function parameters.

* jk/unused-fixes:
  xdiff: drop unused mmfile parameters from xdl_do_patience_diff()
  reflog: assert PARSE_OPT_NONEG in parse-options callbacks
  reftable: drop unused parameter from reader_seek_linear()
  verify_one_sparse(): drop unused parameters
  match_pathname(): drop unused "flags" parameter
  log-tree: drop unused commit param in remerge_diff()
  xdiff: drop unused mmfile parameters from xdl_do_histogram_diff()
This commit is contained in:
Junio C Hamano 2022-08-29 14:55:12 -07:00
Родитель a572a5d4c1 12a58f9014
Коммит a0ab573bb1
11 изменённых файлов: 27 добавлений и 40 удалений

2
attr.c
Просмотреть файл

@ -1023,7 +1023,7 @@ static int path_matches(const char *pathname, int pathlen,
}
return match_pathname(pathname, pathlen - isdir,
base, baselen,
pattern, prefix, pat->patternlen, pat->flags);
pattern, prefix, pat->patternlen);
}
static int macroexpand_one(struct all_attrs_item *all_attrs, int nr, int rem);

Просмотреть файл

@ -193,6 +193,8 @@ static int expire_unreachable_callback(const struct option *opt,
{
struct cmd_reflog_expire_cb *cmd = opt->value;
BUG_ON_OPT_NEG(unset);
if (parse_expiry_date(arg, &cmd->expire_unreachable))
die(_("invalid timestamp '%s' given to '--%s'"),
arg, opt->long_name);
@ -207,6 +209,8 @@ static int expire_total_callback(const struct option *opt,
{
struct cmd_reflog_expire_cb *cmd = opt->value;
BUG_ON_OPT_NEG(unset);
if (parse_expiry_date(arg, &cmd->expire_total))
die(_("invalid timestamp '%s' given to '--%s'"),
arg, opt->long_name);

Просмотреть файл

@ -857,9 +857,7 @@ int cache_tree_matches_traversal(struct cache_tree *root,
return 0;
}
static void verify_one_sparse(struct repository *r,
struct index_state *istate,
struct cache_tree *it,
static void verify_one_sparse(struct index_state *istate,
struct strbuf *path,
int pos)
{
@ -910,7 +908,7 @@ static int verify_one(struct repository *r,
return 1;
if (pos >= 0) {
verify_one_sparse(r, istate, it, path, pos);
verify_one_sparse(istate, path, pos);
return 0;
}

6
dir.c
Просмотреть файл

@ -1244,8 +1244,7 @@ int match_basename(const char *basename, int basenamelen,
int match_pathname(const char *pathname, int pathlen,
const char *base, int baselen,
const char *pattern, int prefix, int patternlen,
unsigned flags)
const char *pattern, int prefix, int patternlen)
{
const char *name;
int namelen;
@ -1347,8 +1346,7 @@ static struct path_pattern *last_matching_pattern_from_list(const char *pathname
if (match_pathname(pathname, pathlen,
pattern->base,
pattern->baselen ? pattern->baselen - 1 : 0,
exclude, prefix, pattern->patternlen,
pattern->flags)) {
exclude, prefix, pattern->patternlen)) {
res = pattern;
break;
}

2
dir.h
Просмотреть файл

@ -414,7 +414,7 @@ int match_basename(const char *, int,
const char *, int, int, unsigned);
int match_pathname(const char *, int,
const char *, int,
const char *, int, int, unsigned);
const char *, int, int);
struct path_pattern *last_matching_pattern(struct dir_struct *dir,
struct index_state *istate,

Просмотреть файл

@ -963,8 +963,7 @@ static void cleanup_additional_headers(struct diff_options *o)
static int do_remerge_diff(struct rev_info *opt,
struct commit_list *parents,
struct object_id *oid,
struct commit *commit)
struct object_id *oid)
{
struct merge_options o;
struct commit_list *bases;
@ -1059,7 +1058,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
"for octopus merges.\n");
return 1;
}
return do_remerge_diff(opt, parents, oid, commit);
return do_remerge_diff(opt, parents, oid);
}
if (opt->combine_merges)
return do_diff_combined(opt, commit);

Просмотреть файл

@ -443,7 +443,7 @@ static int reader_start(struct reftable_reader *r, struct table_iter *ti,
return reader_table_iter_at(r, ti, off, typ);
}
static int reader_seek_linear(struct reftable_reader *r, struct table_iter *ti,
static int reader_seek_linear(struct table_iter *ti,
struct reftable_record *want)
{
struct reftable_record rec =
@ -510,7 +510,7 @@ static int reader_seek_indexed(struct reftable_reader *r,
if (err < 0)
goto done;
err = reader_seek_linear(r, &index_iter, &want_index);
err = reader_seek_linear(&index_iter, &want_index);
while (1) {
err = table_iter_next(&index_iter, &index_result);
table_iter_block_done(&index_iter);
@ -570,7 +570,7 @@ static int reader_seek_internal(struct reftable_reader *r,
err = reader_start(r, &ti, reftable_record_type(rec), 0);
if (err < 0)
return err;
err = reader_seek_linear(r, &ti, rec);
err = reader_seek_linear(&ti, rec);
if (err < 0)
return err;
else {

Просмотреть файл

@ -321,12 +321,12 @@ int xdl_do_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
return -1;
if (XDF_DIFF_ALG(xpp->flags) == XDF_PATIENCE_DIFF) {
res = xdl_do_patience_diff(mf1, mf2, xpp, xe);
res = xdl_do_patience_diff(xpp, xe);
goto out;
}
if (XDF_DIFF_ALG(xpp->flags) == XDF_HISTOGRAM_DIFF) {
res = xdl_do_histogram_diff(mf1, mf2, xpp, xe);
res = xdl_do_histogram_diff(xpp, xe);
goto out;
}

Просмотреть файл

@ -56,9 +56,7 @@ int xdl_build_script(xdfenv_t *xe, xdchange_t **xscr);
void xdl_free_script(xdchange_t *xscr);
int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
xdemitconf_t const *xecfg);
int xdl_do_patience_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
xdfenv_t *env);
int xdl_do_histogram_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
xdfenv_t *env);
int xdl_do_patience_diff(xpparam_t const *xpp, xdfenv_t *env);
int xdl_do_histogram_diff(xpparam_t const *xpp, xdfenv_t *env);
#endif /* #if !defined(XDIFFI_H) */

Просмотреть файл

@ -362,8 +362,7 @@ out:
return result;
}
int xdl_do_histogram_diff(mmfile_t *file1, mmfile_t *file2,
xpparam_t const *xpp, xdfenv_t *env)
int xdl_do_histogram_diff(xpparam_t const *xpp, xdfenv_t *env)
{
return histogram_diff(xpp, env,
env->xdf1.dstart + 1, env->xdf1.dend - env->xdf1.dstart + 1,

Просмотреть файл

@ -69,7 +69,6 @@ struct hashmap {
} *entries, *first, *last;
/* were common records found? */
unsigned long has_matches;
mmfile_t *file1, *file2;
xdfenv_t *env;
xpparam_t const *xpp;
};
@ -139,13 +138,10 @@ static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map,
*
* It is assumed that env has been prepared using xdl_prepare().
*/
static int fill_hashmap(mmfile_t *file1, mmfile_t *file2,
xpparam_t const *xpp, xdfenv_t *env,
static int fill_hashmap(xpparam_t const *xpp, xdfenv_t *env,
struct hashmap *result,
int line1, int count1, int line2, int count2)
{
result->file1 = file1;
result->file2 = file2;
result->xpp = xpp;
result->env = env;
@ -254,8 +250,7 @@ static int match(struct hashmap *map, int line1, int line2)
return record1->ha == record2->ha;
}
static int patience_diff(mmfile_t *file1, mmfile_t *file2,
xpparam_t const *xpp, xdfenv_t *env,
static int patience_diff(xpparam_t const *xpp, xdfenv_t *env,
int line1, int count1, int line2, int count2);
static int walk_common_sequence(struct hashmap *map, struct entry *first,
@ -286,8 +281,7 @@ static int walk_common_sequence(struct hashmap *map, struct entry *first,
/* Recurse */
if (next1 > line1 || next2 > line2) {
if (patience_diff(map->file1, map->file2,
map->xpp, map->env,
if (patience_diff(map->xpp, map->env,
line1, next1 - line1,
line2, next2 - line2))
return -1;
@ -326,8 +320,7 @@ static int fall_back_to_classic_diff(struct hashmap *map,
*
* This function assumes that env was prepared with xdl_prepare_env().
*/
static int patience_diff(mmfile_t *file1, mmfile_t *file2,
xpparam_t const *xpp, xdfenv_t *env,
static int patience_diff(xpparam_t const *xpp, xdfenv_t *env,
int line1, int count1, int line2, int count2)
{
struct hashmap map;
@ -346,7 +339,7 @@ static int patience_diff(mmfile_t *file1, mmfile_t *file2,
}
memset(&map, 0, sizeof(map));
if (fill_hashmap(file1, file2, xpp, env, &map,
if (fill_hashmap(xpp, env, &map,
line1, count1, line2, count2))
return -1;
@ -374,9 +367,7 @@ static int patience_diff(mmfile_t *file1, mmfile_t *file2,
return result;
}
int xdl_do_patience_diff(mmfile_t *file1, mmfile_t *file2,
xpparam_t const *xpp, xdfenv_t *env)
int xdl_do_patience_diff(xpparam_t const *xpp, xdfenv_t *env)
{
return patience_diff(file1, file2, xpp, env,
1, env->xdf1.nrec, 1, env->xdf2.nrec);
return patience_diff(xpp, env, 1, env->xdf1.nrec, 1, env->xdf2.nrec);
}