Fossil SCM
Revert two small sections of [4c3e1728e1b1a9cb] for cases which are not compatible with fsl_strdup()'s passing-on of NULL values. Found while investigating a presumably unrelated crash.
Commit
20adff9572f49fa51c22e294a78315249258aeeb25012cb7a9984763f40e00e9
Parent
ecf44a280d7df53…
1 file changed
+5
-5
+5
-5
| --- src/search.c | ||
| +++ src/search.c | ||
| @@ -130,14 +130,14 @@ | ||
| 130 | 130 | search_end(p); |
| 131 | 131 | }else{ |
| 132 | 132 | p = fossil_malloc(sizeof(*p)); |
| 133 | 133 | memset(p, 0, sizeof(*p)); |
| 134 | 134 | } |
| 135 | - p->zPattern = z = fossil_strdup(zPattern); | |
| 136 | - p->zMarkBegin = fossil_strdup(zMarkBegin); | |
| 137 | - p->zMarkEnd = fossil_strdup(zMarkEnd); | |
| 138 | - p->zMarkGap = fossil_strdup(zMarkGap); | |
| 135 | + p->zPattern = z = mprintf("%s",zPattern); | |
| 136 | + p->zMarkBegin = mprintf("%s",zMarkBegin); | |
| 137 | + p->zMarkEnd = mprintf("%s",zMarkEnd); | |
| 138 | + p->zMarkGap = mprintf("%s",zMarkGap); | |
| 139 | 139 | p->fSrchFlg = fSrchFlg; |
| 140 | 140 | blob_init(&p->snip, 0, 0); |
| 141 | 141 | while( *z && p->nTerm<SEARCH_MAX_TERM ){ |
| 142 | 142 | while( *z && !ISALNUM(*z) ){ z++; } |
| 143 | 143 | if( *z==0 ) break; |
| @@ -1076,11 +1076,11 @@ | ||
| 1076 | 1076 | ** causing errors in FTS5 searches with inputs which contain AND, OR, |
| 1077 | 1077 | ** and symbols like #. The caller is responsible for passing the |
| 1078 | 1078 | ** result to fossil_free(). |
| 1079 | 1079 | */ |
| 1080 | 1080 | char *search_simplify_pattern(const char * zPattern){ |
| 1081 | - char *zPat = fossil_strdup(zPattern); | |
| 1081 | + char *zPat = mprintf("%s",zPattern); | |
| 1082 | 1082 | int i; |
| 1083 | 1083 | for(i=0; zPat[i]; i++){ |
| 1084 | 1084 | if( (zPat[i]&0x80)==0 && !fossil_isalnum(zPat[i]) ) zPat[i] = ' '; |
| 1085 | 1085 | if( fossil_isupper(zPat[i]) ) zPat[i] = fossil_tolower(zPat[i]); |
| 1086 | 1086 | } |
| 1087 | 1087 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -130,14 +130,14 @@ | |
| 130 | search_end(p); |
| 131 | }else{ |
| 132 | p = fossil_malloc(sizeof(*p)); |
| 133 | memset(p, 0, sizeof(*p)); |
| 134 | } |
| 135 | p->zPattern = z = fossil_strdup(zPattern); |
| 136 | p->zMarkBegin = fossil_strdup(zMarkBegin); |
| 137 | p->zMarkEnd = fossil_strdup(zMarkEnd); |
| 138 | p->zMarkGap = fossil_strdup(zMarkGap); |
| 139 | p->fSrchFlg = fSrchFlg; |
| 140 | blob_init(&p->snip, 0, 0); |
| 141 | while( *z && p->nTerm<SEARCH_MAX_TERM ){ |
| 142 | while( *z && !ISALNUM(*z) ){ z++; } |
| 143 | if( *z==0 ) break; |
| @@ -1076,11 +1076,11 @@ | |
| 1076 | ** causing errors in FTS5 searches with inputs which contain AND, OR, |
| 1077 | ** and symbols like #. The caller is responsible for passing the |
| 1078 | ** result to fossil_free(). |
| 1079 | */ |
| 1080 | char *search_simplify_pattern(const char * zPattern){ |
| 1081 | char *zPat = fossil_strdup(zPattern); |
| 1082 | int i; |
| 1083 | for(i=0; zPat[i]; i++){ |
| 1084 | if( (zPat[i]&0x80)==0 && !fossil_isalnum(zPat[i]) ) zPat[i] = ' '; |
| 1085 | if( fossil_isupper(zPat[i]) ) zPat[i] = fossil_tolower(zPat[i]); |
| 1086 | } |
| 1087 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -130,14 +130,14 @@ | |
| 130 | search_end(p); |
| 131 | }else{ |
| 132 | p = fossil_malloc(sizeof(*p)); |
| 133 | memset(p, 0, sizeof(*p)); |
| 134 | } |
| 135 | p->zPattern = z = mprintf("%s",zPattern); |
| 136 | p->zMarkBegin = mprintf("%s",zMarkBegin); |
| 137 | p->zMarkEnd = mprintf("%s",zMarkEnd); |
| 138 | p->zMarkGap = mprintf("%s",zMarkGap); |
| 139 | p->fSrchFlg = fSrchFlg; |
| 140 | blob_init(&p->snip, 0, 0); |
| 141 | while( *z && p->nTerm<SEARCH_MAX_TERM ){ |
| 142 | while( *z && !ISALNUM(*z) ){ z++; } |
| 143 | if( *z==0 ) break; |
| @@ -1076,11 +1076,11 @@ | |
| 1076 | ** causing errors in FTS5 searches with inputs which contain AND, OR, |
| 1077 | ** and symbols like #. The caller is responsible for passing the |
| 1078 | ** result to fossil_free(). |
| 1079 | */ |
| 1080 | char *search_simplify_pattern(const char * zPattern){ |
| 1081 | char *zPat = mprintf("%s",zPattern); |
| 1082 | int i; |
| 1083 | for(i=0; zPat[i]; i++){ |
| 1084 | if( (zPat[i]&0x80)==0 && !fossil_isalnum(zPat[i]) ) zPat[i] = ' '; |
| 1085 | if( fossil_isupper(zPat[i]) ) zPat[i] = fossil_tolower(zPat[i]); |
| 1086 | } |
| 1087 |