Fossil SCM

s/re_exec\b/re_execute/g, for compatibility with BSD.

stephan 2013-01-02 11:39 trunk
Commit 6a26eb349743852f9c215d9cc5a9f6b2adfecaf3
2 files changed +1 -1 +6 -6
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -423,11 +423,11 @@
423423
ReCompiled *pRe, /* The regular expression to be matched */
424424
DLine *aDLine, /* First of N DLines to compare against */
425425
int N /* Number of DLines to check */
426426
){
427427
while( N-- ){
428
- if( re_exec(pRe, aDLine->z, LENGTH(aDLine)) ){
428
+ if( re_execute(pRe, aDLine->z, LENGTH(aDLine)) ){
429429
return 1;
430430
}
431431
aDLine++;
432432
}
433433
return 0;
434434
--- src/diff.c
+++ src/diff.c
@@ -423,11 +423,11 @@
423 ReCompiled *pRe, /* The regular expression to be matched */
424 DLine *aDLine, /* First of N DLines to compare against */
425 int N /* Number of DLines to check */
426 ){
427 while( N-- ){
428 if( re_exec(pRe, aDLine->z, LENGTH(aDLine)) ){
429 return 1;
430 }
431 aDLine++;
432 }
433 return 0;
434
--- src/diff.c
+++ src/diff.c
@@ -423,11 +423,11 @@
423 ReCompiled *pRe, /* The regular expression to be matched */
424 DLine *aDLine, /* First of N DLines to compare against */
425 int N /* Number of DLines to check */
426 ){
427 while( N-- ){
428 if( re_execute(pRe, aDLine->z, LENGTH(aDLine)) ){
429 return 1;
430 }
431 aDLine++;
432 }
433 return 0;
434
+6 -6
--- src/regexp.c
+++ src/regexp.c
@@ -178,11 +178,11 @@
178178
}
179179
180180
/* Run a compiled regular expression on the zero-terminated input
181181
** string zIn[]. Return true on a match and false if there is no match.
182182
*/
183
-int re_exec(ReCompiled *pRe, const unsigned char *zIn, int nIn){
183
+int re_execute(ReCompiled *pRe, const unsigned char *zIn, int nIn){
184184
ReStateSet aStateSet[2], *pThis, *pNext;
185185
ReStateNumber aSpace[100];
186186
ReStateNumber *pToFree;
187187
unsigned int i = 0;
188188
unsigned int iSwap = 0;
@@ -275,11 +275,11 @@
275275
re_add_state(pThis, x+pRe->aArg[x]);
276276
break;
277277
}
278278
case RE_OP_ACCEPT: {
279279
rc = 1;
280
- goto re_exec_end;
280
+ goto re_execute_end;
281281
}
282282
case RE_OP_CC_INC:
283283
case RE_OP_CC_EXC: {
284284
int j = 1;
285285
int n = pRe->aArg[x];
@@ -307,11 +307,11 @@
307307
}
308308
}
309309
for(i=0; i<pNext->nState; i++){
310310
if( pRe->aOp[pNext->aState[i]]==RE_OP_ACCEPT ){ rc = 1; break; }
311311
}
312
-re_exec_end:
312
+re_execute_end:
313313
fossil_free(pToFree);
314314
return rc;
315315
}
316316
317317
/* Resize the opcode and argument arrays for an RE under construction.
@@ -599,11 +599,11 @@
599599
}
600600
}
601601
602602
/*
603603
** Compile a textual regular expression in zIn[] into a compiled regular
604
-** expression suitable for us by re_exec() and return a pointer to the
604
+** expression suitable for us by re_execute() and return a pointer to the
605605
** compiled regular expression in *ppRe. Return NULL on success or an
606606
** error message if something goes wrong.
607607
*/
608608
const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
609609
ReCompiled *pRe;
@@ -700,11 +700,11 @@
700700
}
701701
sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
702702
}
703703
zStr = (const unsigned char*)sqlite3_value_text(argv[1]);
704704
if( zStr!=0 ){
705
- sqlite3_result_int(context, re_exec(pRe, zStr, -1));
705
+ sqlite3_result_int(context, re_execute(pRe, zStr, -1));
706706
}
707707
}
708708
709709
/*
710710
** Invoke this routine in order to install the REGEXP function in an
@@ -731,11 +731,11 @@
731731
char zLine[2000];
732732
while( fgets(zLine, sizeof(zLine), in) ){
733733
ln++;
734734
n = (int)strlen(zLine);
735735
while( n && (zLine[n-1]=='\n' || zLine[n-1]=='\r') ) n--;
736
- if( re_exec(pRe, (const unsigned char*)zLine, n) ){
736
+ if( re_execute(pRe, (const unsigned char*)zLine, n) ){
737737
printf("%s:%d:%.*s\n", zFile, ln, n, zLine);
738738
}
739739
}
740740
}
741741
742742
--- src/regexp.c
+++ src/regexp.c
@@ -178,11 +178,11 @@
178 }
179
180 /* Run a compiled regular expression on the zero-terminated input
181 ** string zIn[]. Return true on a match and false if there is no match.
182 */
183 int re_exec(ReCompiled *pRe, const unsigned char *zIn, int nIn){
184 ReStateSet aStateSet[2], *pThis, *pNext;
185 ReStateNumber aSpace[100];
186 ReStateNumber *pToFree;
187 unsigned int i = 0;
188 unsigned int iSwap = 0;
@@ -275,11 +275,11 @@
275 re_add_state(pThis, x+pRe->aArg[x]);
276 break;
277 }
278 case RE_OP_ACCEPT: {
279 rc = 1;
280 goto re_exec_end;
281 }
282 case RE_OP_CC_INC:
283 case RE_OP_CC_EXC: {
284 int j = 1;
285 int n = pRe->aArg[x];
@@ -307,11 +307,11 @@
307 }
308 }
309 for(i=0; i<pNext->nState; i++){
310 if( pRe->aOp[pNext->aState[i]]==RE_OP_ACCEPT ){ rc = 1; break; }
311 }
312 re_exec_end:
313 fossil_free(pToFree);
314 return rc;
315 }
316
317 /* Resize the opcode and argument arrays for an RE under construction.
@@ -599,11 +599,11 @@
599 }
600 }
601
602 /*
603 ** Compile a textual regular expression in zIn[] into a compiled regular
604 ** expression suitable for us by re_exec() and return a pointer to the
605 ** compiled regular expression in *ppRe. Return NULL on success or an
606 ** error message if something goes wrong.
607 */
608 const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
609 ReCompiled *pRe;
@@ -700,11 +700,11 @@
700 }
701 sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
702 }
703 zStr = (const unsigned char*)sqlite3_value_text(argv[1]);
704 if( zStr!=0 ){
705 sqlite3_result_int(context, re_exec(pRe, zStr, -1));
706 }
707 }
708
709 /*
710 ** Invoke this routine in order to install the REGEXP function in an
@@ -731,11 +731,11 @@
731 char zLine[2000];
732 while( fgets(zLine, sizeof(zLine), in) ){
733 ln++;
734 n = (int)strlen(zLine);
735 while( n && (zLine[n-1]=='\n' || zLine[n-1]=='\r') ) n--;
736 if( re_exec(pRe, (const unsigned char*)zLine, n) ){
737 printf("%s:%d:%.*s\n", zFile, ln, n, zLine);
738 }
739 }
740 }
741
742
--- src/regexp.c
+++ src/regexp.c
@@ -178,11 +178,11 @@
178 }
179
180 /* Run a compiled regular expression on the zero-terminated input
181 ** string zIn[]. Return true on a match and false if there is no match.
182 */
183 int re_execute(ReCompiled *pRe, const unsigned char *zIn, int nIn){
184 ReStateSet aStateSet[2], *pThis, *pNext;
185 ReStateNumber aSpace[100];
186 ReStateNumber *pToFree;
187 unsigned int i = 0;
188 unsigned int iSwap = 0;
@@ -275,11 +275,11 @@
275 re_add_state(pThis, x+pRe->aArg[x]);
276 break;
277 }
278 case RE_OP_ACCEPT: {
279 rc = 1;
280 goto re_execute_end;
281 }
282 case RE_OP_CC_INC:
283 case RE_OP_CC_EXC: {
284 int j = 1;
285 int n = pRe->aArg[x];
@@ -307,11 +307,11 @@
307 }
308 }
309 for(i=0; i<pNext->nState; i++){
310 if( pRe->aOp[pNext->aState[i]]==RE_OP_ACCEPT ){ rc = 1; break; }
311 }
312 re_execute_end:
313 fossil_free(pToFree);
314 return rc;
315 }
316
317 /* Resize the opcode and argument arrays for an RE under construction.
@@ -599,11 +599,11 @@
599 }
600 }
601
602 /*
603 ** Compile a textual regular expression in zIn[] into a compiled regular
604 ** expression suitable for us by re_execute() and return a pointer to the
605 ** compiled regular expression in *ppRe. Return NULL on success or an
606 ** error message if something goes wrong.
607 */
608 const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
609 ReCompiled *pRe;
@@ -700,11 +700,11 @@
700 }
701 sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
702 }
703 zStr = (const unsigned char*)sqlite3_value_text(argv[1]);
704 if( zStr!=0 ){
705 sqlite3_result_int(context, re_execute(pRe, zStr, -1));
706 }
707 }
708
709 /*
710 ** Invoke this routine in order to install the REGEXP function in an
@@ -731,11 +731,11 @@
731 char zLine[2000];
732 while( fgets(zLine, sizeof(zLine), in) ){
733 ln++;
734 n = (int)strlen(zLine);
735 while( n && (zLine[n-1]=='\n' || zLine[n-1]=='\r') ) n--;
736 if( re_execute(pRe, (const unsigned char*)zLine, n) ){
737 printf("%s:%d:%.*s\n", zFile, ln, n, zLine);
738 }
739 }
740 }
741
742

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button