Re: [PATCH 10/19] tree_entry_interesting(): factor out most matching logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyán ThÃi Ngác Duy  <pclouds@xxxxxxxxx> writes:

> diff --git a/tree-walk.c b/tree-walk.c
> index 01168ea..40a4657 100644
> --- a/tree-walk.c
> +++ b/tree-walk.c
> @@ -481,88 +566,21 @@ int tree_entry_interesting(const struct name_entry *entry,
>  	for (i = 0; i < ps->nr; i++) {
>  		const char *match = ps->raw[i];
>  		int matchlen = ps->items[i].len;
> -		int m = -1; /* signals that we haven't called strncmp() */
>  
>  		if (baselen >= matchlen) {
> -			/* If it doesn't match, move along... */

Why lose this comment?  That is exactly what this simplified part is
about.  If match-dir-prefix says it doesn't match, we move along.

Keep this comment here, and drop the one you copied to the beginning of
match-dir-prefix, which is not about "moving along" anymore.  The function
is about deciding if they match or not.

> -			if (strncmp(base, match, matchlen))
> +			if (!match_dir_prefix(base, baselen, match, matchlen))
> +				/* Just a random prefix match */
>  				continue;

This comment no longer holds true, even though the same comment at the end
of match-dir-prefix function is correct.  This should probably say "does
not match", but that is something you already said.

Other than that, this is a very nice refactoring.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]