mirror of
https://github.com/privacore/open-source-search-engine.git
synced 2025-07-14 02:36:06 -04:00
Remove unused/always false args from getMatches2
This commit is contained in:
@ -506,16 +506,7 @@ int32_t getAdultPoints ( char *s, int32_t slen, const char *url ) {
|
||||
// . then check each match to see if it is actually a legit word
|
||||
// . actually match the dirty words, then match the clean words
|
||||
// then we can subtract counts.
|
||||
getMatches2 ( s_dirtyWords ,
|
||||
dirtyWordsMatches,
|
||||
numDirty ,
|
||||
s ,
|
||||
slen ,
|
||||
NULL , // linkPos
|
||||
NULL , // needleNum
|
||||
false , // stopAtFirstMatch?
|
||||
NULL , // hadPreMatch ptr
|
||||
true ); // saveQuickTables?
|
||||
getMatches2(s_dirtyWords, dirtyWordsMatches, numDirty, s, slen, NULL, NULL);
|
||||
|
||||
int32_t points = 0;
|
||||
// each needle has an associated score
|
||||
|
48
linkspam.cpp
48
linkspam.cpp
@ -452,16 +452,7 @@ bool setLinkSpam ( int32_t ip ,
|
||||
NeedleMatch needleMatches1[numNeedles1];
|
||||
|
||||
bool hadPreMatch;
|
||||
getMatches2 ( s_needles1 ,
|
||||
needleMatches1,
|
||||
numNeedles1 ,
|
||||
haystack ,
|
||||
haystackSize ,
|
||||
NULL , // linkPos ,
|
||||
NULL , // &n ,
|
||||
false , // stopAtFirstMatch
|
||||
&hadPreMatch ,
|
||||
true ); // save quicktables
|
||||
getMatches2(s_needles1, needleMatches1, numNeedles1, haystack, haystackSize, NULL, &hadPreMatch);
|
||||
|
||||
// see if we got a hit
|
||||
char *minPtr = NULL;
|
||||
@ -512,16 +503,7 @@ bool setLinkSpam ( int32_t ip ,
|
||||
haystack = links->getLinkBuf();
|
||||
haystackSize = links->getLinkBufLen();
|
||||
NeedleMatch needleMatches2[numNeedles2];
|
||||
getMatches2 ( s_needles2 ,
|
||||
needleMatches2,
|
||||
numNeedles2 ,
|
||||
haystack ,
|
||||
haystackSize ,
|
||||
NULL , // linkPos,
|
||||
NULL , // &n ,
|
||||
false , // stopAtFirstMatch?
|
||||
NULL ,
|
||||
true ); // save quicktables
|
||||
getMatches2(s_needles2, needleMatches2, numNeedles2, haystack, haystackSize, NULL, NULL);
|
||||
|
||||
// see if we got a hit
|
||||
for ( int32_t i = 0 ; i < numNeedles2 ; i++ ) {
|
||||
@ -731,21 +713,10 @@ bool isLinkSpam ( const Url *linker,
|
||||
|
||||
// do not call them "bad links" if our link occurs before any
|
||||
// comment section. our link's position therefore needs to be known,
|
||||
// that is why we pass in linkPos.
|
||||
// "n" is the number it matches.
|
||||
int32_t n;
|
||||
// that is why we pass in linkPos.
|
||||
NeedleMatch needleMatches1[numNeedles1];
|
||||
bool hadPreMatch;
|
||||
getMatches2 ( s_needles1 ,
|
||||
needleMatches1,
|
||||
numNeedles1 ,
|
||||
haystack ,
|
||||
haystackSize ,
|
||||
linkPos ,
|
||||
&n ,
|
||||
false , // stopAtFirstMatch
|
||||
&hadPreMatch ,
|
||||
true ); // save quicktables
|
||||
getMatches2(s_needles1, needleMatches1, numNeedles1, haystack, haystackSize, linkPos, &hadPreMatch);
|
||||
|
||||
// see if we got a hit
|
||||
for ( int32_t i = 0 ; i < numNeedles1 ; i++ ) {
|
||||
@ -761,16 +732,7 @@ bool isLinkSpam ( const Url *linker,
|
||||
haystack = links->getLinkBuf();
|
||||
haystackSize = links->getLinkBufLen();
|
||||
NeedleMatch needleMatches2[numNeedles2];
|
||||
getMatches2 ( s_needles2 ,
|
||||
needleMatches2,
|
||||
numNeedles2 ,
|
||||
haystack ,
|
||||
haystackSize ,
|
||||
NULL , // linkPos,
|
||||
NULL , // &n ,
|
||||
false , // stopAtFirstMatch?
|
||||
NULL , // hadPreMatch?
|
||||
true ); // save quicktables
|
||||
getMatches2(s_needles2, needleMatches2, numNeedles2, haystack, haystackSize, NULL, NULL);
|
||||
|
||||
// see if we got a hit
|
||||
for ( int32_t i = 0 ; i < numNeedles2 ; i++ ) {
|
||||
|
33
matches2.cpp
33
matches2.cpp
@ -29,17 +29,8 @@ bool initializeNeedle(Needle *needles, int32_t numNeedles) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char *getMatches2 ( const Needle *needles ,
|
||||
NeedleMatch *needlesMatch,
|
||||
int32_t numNeedles ,
|
||||
char *haystack ,
|
||||
int32_t haystackSize ,
|
||||
char *linkPos ,
|
||||
int32_t *needleNum ,
|
||||
bool stopAtFirstMatch ,
|
||||
bool *hadPreMatch ,
|
||||
bool saveQuickTables ) {
|
||||
|
||||
char *getMatches2(const Needle *needles, NeedleMatch *needlesMatch, int32_t numNeedles,
|
||||
char *haystack, int32_t haystackSize, char *linkPos, bool *hadPreMatch) {
|
||||
// assume not
|
||||
if ( hadPreMatch ) *hadPreMatch = false;
|
||||
// empty haystack? then no matches
|
||||
@ -224,15 +215,7 @@ char *getMatches2 ( const Needle *needles ,
|
||||
// store ptr if NULL
|
||||
if ( ! needlesMatch[j].m_firstMatch )
|
||||
needlesMatch[j].m_firstMatch = (char *)p;
|
||||
// return ptr to needle in "haystack"
|
||||
if ( stopAtFirstMatch ) {
|
||||
// ok, we got a match
|
||||
if ( needleNum ) *needleNum = j;
|
||||
//return (char *)p;
|
||||
retVal = (char *)p;
|
||||
p = pend;
|
||||
break;
|
||||
}
|
||||
|
||||
// otherwise, just count it
|
||||
needlesMatch[j].m_count++;
|
||||
// see if we match another needle, fixes bug
|
||||
@ -351,15 +334,7 @@ char *getMatches2 ( const Needle *needles ,
|
||||
// store ptr if NULL
|
||||
if ( ! needlesMatch[j].m_firstMatch )
|
||||
needlesMatch[j].m_firstMatch = (char *)p;
|
||||
// return ptr to needle in "haystack"
|
||||
if ( stopAtFirstMatch ) {
|
||||
// ok, we got a match
|
||||
if ( needleNum ) *needleNum = j;
|
||||
//return (char *)p;
|
||||
retVal = (char *)p;
|
||||
p = pend;
|
||||
break;
|
||||
}
|
||||
|
||||
// otherwise, just count it
|
||||
needlesMatch[j].m_count++;
|
||||
// advance to next char in the haystack
|
||||
|
12
matches2.h
12
matches2.h
@ -31,16 +31,8 @@ public:
|
||||
|
||||
bool initializeNeedle(Needle *needles, int32_t numNeedles);
|
||||
|
||||
char *getMatches2 ( const Needle *needles ,
|
||||
NeedleMatch *needlesMatch,
|
||||
int32_t numNeedles ,
|
||||
char *haystack ,
|
||||
int32_t haystackSize ,
|
||||
char *linkPos ,
|
||||
int32_t *n ,
|
||||
bool stopAtFirstMatch ,
|
||||
bool *hadPreMatch ,
|
||||
bool saveQuickTables );
|
||||
char *getMatches2(const Needle *needles, NeedleMatch *needlesMatch, int32_t numNeedles,
|
||||
char *haystack, int32_t haystackSize, char *linkPos, bool *hadPreMatch);
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user