* dm/tree-walk:
  tree-walk: micro-optimization in tree_entry_interesting
  tree-walk: drop unused parameter from match_dir_prefix
This commit is contained in:
Junio C Hamano 2011-10-10 15:56:20 -07:00
Родитель 59b32ff338 1b74092373
Коммит 4909bbe40a
1 изменённых файлов: 4 добавлений и 4 удалений

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

@ -549,7 +549,7 @@ static int match_entry(const struct name_entry *entry, int pathlen,
return 0; return 0;
} }
static int match_dir_prefix(const char *base, int baselen, static int match_dir_prefix(const char *base,
const char *match, int matchlen) const char *match, int matchlen)
{ {
if (strncmp(base, match, matchlen)) if (strncmp(base, match, matchlen))
@ -606,7 +606,7 @@ int tree_entry_interesting(const struct name_entry *entry,
if (baselen >= matchlen) { if (baselen >= matchlen) {
/* If it doesn't match, move along... */ /* If it doesn't match, move along... */
if (!match_dir_prefix(base_str, baselen, match, matchlen)) if (!match_dir_prefix(base_str, match, matchlen))
goto match_wildcards; goto match_wildcards;
if (!ps->recursive || ps->max_depth == -1) if (!ps->recursive || ps->max_depth == -1)
@ -618,8 +618,8 @@ int tree_entry_interesting(const struct name_entry *entry,
ps->max_depth); ps->max_depth);
} }
/* Does the base match? */ /* Either there must be no base, or the base must match. */
if (!strncmp(base_str, match, baselen)) { if (baselen == 0 || !strncmp(base_str, match, baselen)) {
if (match_entry(entry, pathlen, if (match_entry(entry, pathlen,
match + baselen, matchlen - baselen, match + baselen, matchlen - baselen,
&never_interesting)) &never_interesting))