openbsd-ports/devel/cvstrac/patches/patch-search_c
sthen d068153915 import cvstrac; N.B. requires a recent /usr/bin/rlog (thanks Joris!)
CVSTrac implements a patch-set and bug tracking system for CVS
as a single self-contained executable, running as CGI, from inetd,
or as a stand-alone web server.

- Automatically generates a patch-set log from check-in comments
- User-defined color-coded database queries
- Built-in repository browser and Wiki
- Minimal memory, disk and CPU requirements
- Per-user access control
- Uses SQLite, no heavy database engine dependency
- Can be run from a chroot jail
2009-02-17 00:16:04 +00:00

38 lines
1.3 KiB
Plaintext

$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 ){