| | @@ -154,71 +154,11 @@ |
| 154 | 154 | ** characters. |
| 155 | 155 | ** |
| 156 | 156 | ** [^...] Matches one character not in the enclosed list. |
| 157 | 157 | */ |
| 158 | 158 | int strglob(const char *zGlob, const char *z){ |
| 159 | | - int c, c2; |
| 160 | | - int invert; |
| 161 | | - int seen; |
| 162 | | - |
| 163 | | - while( (c = (*(zGlob++)))!=0 ){ |
| 164 | | - if( c=='*' ){ |
| 165 | | - while( (c=(*(zGlob++))) == '*' || c=='?' ){ |
| 166 | | - if( c=='?' && (*(z++))==0 ) return 0; |
| 167 | | - } |
| 168 | | - if( c==0 ){ |
| 169 | | - return 1; |
| 170 | | - }else if( c=='[' ){ |
| 171 | | - while( *z && strglob(zGlob-1,z)==0 ){ |
| 172 | | - z++; |
| 173 | | - } |
| 174 | | - return (*z)!=0; |
| 175 | | - } |
| 176 | | - while( (c2 = (*(z++)))!=0 ){ |
| 177 | | - while( c2!=c ){ |
| 178 | | - c2 = *(z++); |
| 179 | | - if( c2==0 ) return 0; |
| 180 | | - } |
| 181 | | - if( strglob(zGlob,z) ) return 1; |
| 182 | | - } |
| 183 | | - return 0; |
| 184 | | - }else if( c=='?' ){ |
| 185 | | - if( (*(z++))==0 ) return 0; |
| 186 | | - }else if( c=='[' ){ |
| 187 | | - int prior_c = 0; |
| 188 | | - seen = 0; |
| 189 | | - invert = 0; |
| 190 | | - c = *(z++); |
| 191 | | - if( c==0 ) return 0; |
| 192 | | - c2 = *(zGlob++); |
| 193 | | - if( c2=='^' ){ |
| 194 | | - invert = 1; |
| 195 | | - c2 = *(zGlob++); |
| 196 | | - } |
| 197 | | - if( c2==']' ){ |
| 198 | | - if( c==']' ) seen = 1; |
| 199 | | - c2 = *(zGlob++); |
| 200 | | - } |
| 201 | | - while( c2 && c2!=']' ){ |
| 202 | | - if( c2=='-' && zGlob[0]!=']' && zGlob[0]!=0 && prior_c>0 ){ |
| 203 | | - c2 = *(zGlob++); |
| 204 | | - if( c>=prior_c && c<=c2 ) seen = 1; |
| 205 | | - prior_c = 0; |
| 206 | | - }else{ |
| 207 | | - if( c==c2 ){ |
| 208 | | - seen = 1; |
| 209 | | - } |
| 210 | | - prior_c = c2; |
| 211 | | - } |
| 212 | | - c2 = *(zGlob++); |
| 213 | | - } |
| 214 | | - if( c2==0 || (seen ^ invert)==0 ) return 0; |
| 215 | | - }else{ |
| 216 | | - if( c!=(*(z++)) ) return 0; |
| 217 | | - } |
| 218 | | - } |
| 219 | | - return *z==0; |
| 159 | + return sqlite3_strglob(zGlob, z)==0; |
| 220 | 160 | } |
| 221 | 161 | |
| 222 | 162 | /* |
| 223 | 163 | ** Return true (non-zero) if zString matches any of the patterns in |
| 224 | 164 | ** the Glob. The value returned is actually a 1-based index of the pattern |
| | @@ -228,11 +168,11 @@ |
| 228 | 168 | */ |
| 229 | 169 | int glob_match(Glob *pGlob, const char *zString){ |
| 230 | 170 | int i; |
| 231 | 171 | if( pGlob==0 ) return 0; |
| 232 | 172 | for(i=0; i<pGlob->nPattern; i++){ |
| 233 | | - if( strglob(pGlob->azPattern[i], zString) ) return i+1; |
| 173 | + if( sqlite3_strglob(pGlob->azPattern[i], zString)==0 ) return i+1; |
| 234 | 174 | } |
| 235 | 175 | return 0; |
| 236 | 176 | } |
| 237 | 177 | |
| 238 | 178 | /* |
| 239 | 179 | |