From bb99814ff2eeb0c916a4c5d632bd0c03e3e7ba96 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 15 Feb 2021 20:30:22 +0100 Subject: Refactoring: remove QRegExp in searchindex.cpp --- src/searchindex.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/searchindex.cpp b/src/searchindex.cpp index 89f1681..61d2d6c 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -18,7 +18,6 @@ #include #include -#include #include "searchindex.h" #include "config.h" @@ -200,7 +199,6 @@ static int charsToIndex(const char *word) void SearchIndex::addWord(const char *word,bool hiPriority,bool recurse) { - static QRegExp nextPart("[_a-z:][A-Z]"); if (word==0 || word[0]=='\0') return; QCString wStr = QCString(word).lower(); //printf("SearchIndex::addWord(%s,%d) wStr=%s\n",word,hiPriority,wStr.data()); @@ -227,7 +225,14 @@ void SearchIndex::addWord(const char *word,bool hiPriority,bool recurse) } if (!found) // no prefix stripped { - if ((i=nextPart.match(word))>=1) + i=0; + while (word[i]!=0 && + !((word[i]=='_' || word[i]==':' || (word[i]>='a' && word[i]<='z')) && // [_a-z:] + (word[i+1]>='A' && word[i+1]<='Z'))) // [A-Z] + { + i++; + } + if (word[i]!=0 && i>=1) { addWord(word+i+1,hiPriority,TRUE); } -- cgit v0.12