Skip to content

Commit

Permalink
util/patternMatch: don't extract a QCString(QFileInfo) each time we Q…
Browse files Browse the repository at this point in the history
…RegExp.match

patternMatch iterates over the pattern list, while FileInfo remains
constant.

given this, extract the QCStrings for QFileInfo outside of the
iterating loop.

Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
  • Loading branch information
groleo committed Feb 28, 2014
1 parent de1a8b9 commit 8991d11
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7443,6 +7443,11 @@ bool patternMatch(const QFileInfo &fi,const QStrList *patList)
{
QStrListIterator it(*patList);
QCString pattern;

QCString fn = fi.fileName().data();
QCString fp = fi.filePath().data();
QCString afp= fi.absFilePath().data();

for (it.toFirst();(pattern=it.current());++it)
{
if (!pattern.isEmpty())
Expand All @@ -7455,9 +7460,9 @@ bool patternMatch(const QFileInfo &fi,const QStrList *patList)
#else // unix
QRegExp re(pattern,TRUE,TRUE); // case sensitive match
#endif
found = found || re.match(fi.fileName().data())!=-1 ||
re.match(fi.filePath().data())!=-1 ||
re.match(fi.absFilePath().data())!=-1;
found = re.match(fn)!=-1 ||
re.match(fp)!=-1 ||
re.match(afp)!=-1;
if (found) break;
//printf("Matching `%s' against pattern `%s' found=%d\n",
// fi->fileName().data(),pattern.data(),found);
Expand Down

0 comments on commit 8991d11

Please sign in to comment.