Re: [PATCH v3 04/13] match_basename: use strncmp instead of strcmp

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

 



> --- a/dir.c
> +++ b/dir.c
> @@ -636,12 +636,14 @@ int match_basename(const char *basename, int basenamelen,
>                    int flags)
>  {
>         if (prefix == patternlen) {
> -               if (!strcmp_icase(pattern, basename))
> +               if (patternlen == basenamelen &&
> +                   !strncmp_icase(pattern, basename, patternlen))
>                         return 1;
>         } else if (flags & EXC_FLAG_ENDSWITH) {
>                 if (patternlen - 1 <= basenamelen &&
> -                   !strcmp_icase(pattern + 1,
> -                                 basename + basenamelen - patternlen + 1))
> +                   !strncmp_icase(pattern + 1,
> +                                  basename + basenamelen - patternlen + 1,
> +                                  patternlen - 1))
>                         return 1;


I can see that you kept strncmp(), was it worse with memcmp() ?
--
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]