From: Antoine Pelisse Date: Sat, 09 Mar 2013 09:06:29 GMT Subject: Re: [PATCH 1/3] match_pathname: avoid calling strncmp if baselen is 0 Message-ID: In-Reply-To: <1362802190-7331-2-git-send-email-pclouds@gmail.com> > diff --git a/dir.c b/dir.c > index 57394e4..669cf80 100644 > --- a/dir.c > +++ b/dir.c > @@ -663,7 +663,7 @@ int match_pathname(const char *pathname, int pathlen, > */ > if (pathlen < baselen + 1 || > (baselen && pathname[baselen] != '/') || > - strncmp_icase(pathname, base, baselen)) > + (baselen && strncmp_icase(pathname, base, baselen))) Shouldn't you factorize by baselen here ? For readability reasons, not performance of course. > return 0; > > namelen = baselen ? pathlen - baselen - 1 : pathlen;