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

2013-03-12 Thread Duy Nguyen
On Wed, Mar 13, 2013 at 12:40 AM, Antoine Pelisse wrote: >> --- 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,

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

2013-03-12 Thread Antoine Pelisse
> --- 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 && > +

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

2013-03-12 Thread Nguyễn Thái Ngọc Duy
strncmp provides length information, compared to strcmp, which could be taken advantage by the implementation. Even better, we could check if the lengths are equal before calling strncmp, eliminating a bit of strncmp calls. treat_leading_path: 0.000 0.000 read_directory: 3.558 3.578 +tre