openbsd-ports/devel/cvstrac/patches/patch-search_c

38 lines
1.3 KiB
Plaintext
Raw Normal View History

$OpenBSD: patch-search_c,v 1.1.1.1 2009/02/17 00:16:04 sthen Exp $
http://www.cvstrac.org/cvstrac/chngview?cn=994
Avoid using sqlite internal functions.
--- search.c.orig Thu Dec 14 00:27:25 2006
+++ search.c Thu Aug 7 01:01:25 2008
@@ -29,11 +29,6 @@
/*
-** We'll use this routine in several places.
-*/
-extern int sqlite3StrNICmp(const char*,const char*,int);
-
-/*
** Search for a keyword in text. Return a matching score:
**
** 0 No sign of the word was found in the text
@@ -54,7 +49,7 @@ static int score_word(const char *zWord, const char *z
}
if( n<=0 ) n = strlen(zWord);
for(i=0; zText[i]; i++){
- if( (zText[i]==c1 || zText[i]==c2) && sqlite3StrNICmp(zWord,&zText[i],n)==0){
+ if( (zText[i]==c1 || zText[i]==c2) && strncasecmp(zWord,&zText[i],n)==0){
int score = 6;
if( (i==0 || !isalnum(zText[i-1]))
&& (zText[i+n]==0 || !isalnum(zText[i+n])) ){
@@ -282,7 +277,7 @@ static void highlightFunc(sqlite3_context *context, in
int n;
if( tolower(c)!=tolower(azKey[k][0]) ) continue;
n = keySize[k];
- if( sqlite3StrNICmp(&zAll[j],azKey[k],n)==0 ){
+ if( strncasecmp(&zAll[j],azKey[k],n)==0 ){
strcpy(z,"<b>");
z += 3;
while( n ){