Fossil SCM

Performance optimization in fossil_strcmp().

drh 2019-09-10 11:30 trunk
Commit 72a4b613479ad77bbfc60c8953cc3da598edcf69e4a78c6f7eda5675c98d42fe
1 file changed +1 -6
+1 -6
--- src/util.c
+++ src/util.c
@@ -190,16 +190,11 @@
190190
if( zB==0 ) return 0;
191191
return -1;
192192
}else if( zB==0 ){
193193
return +1;
194194
}else{
195
- int a, b;
196
- do{
197
- a = *zA++;
198
- b = *zB++;
199
- }while( a==b && a!=0 );
200
- return ((unsigned char)a) - (unsigned char)b;
195
+ return strcmp(zA,zB);
201196
}
202197
}
203198
int fossil_strncmp(const char *zA, const char *zB, int nByte){
204199
if( zA==0 ){
205200
if( zB==0 ) return 0;
206201
--- src/util.c
+++ src/util.c
@@ -190,16 +190,11 @@
190 if( zB==0 ) return 0;
191 return -1;
192 }else if( zB==0 ){
193 return +1;
194 }else{
195 int a, b;
196 do{
197 a = *zA++;
198 b = *zB++;
199 }while( a==b && a!=0 );
200 return ((unsigned char)a) - (unsigned char)b;
201 }
202 }
203 int fossil_strncmp(const char *zA, const char *zB, int nByte){
204 if( zA==0 ){
205 if( zB==0 ) return 0;
206
--- src/util.c
+++ src/util.c
@@ -190,16 +190,11 @@
190 if( zB==0 ) return 0;
191 return -1;
192 }else if( zB==0 ){
193 return +1;
194 }else{
195 return strcmp(zA,zB);
 
 
 
 
 
196 }
197 }
198 int fossil_strncmp(const char *zA, const char *zB, int nByte){
199 if( zA==0 ){
200 if( zB==0 ) return 0;
201

Keyboard Shortcuts

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