Mercurial > vim
comparison src/regexp.c @ 170:8c60f65311fa v7.0052
updated for version 7.0052
author | vimboss |
---|---|
date | Sat, 26 Feb 2005 23:04:13 +0000 |
parents | c93c9cad9618 |
children | 84c21eb4fc40 |
comparison
equal
deleted
inserted
replaced
169:0e902b8f511f | 170:8c60f65311fa |
---|---|
3263 c = (*mb_ptr2char)(prog->regmust); | 3263 c = (*mb_ptr2char)(prog->regmust); |
3264 else | 3264 else |
3265 #endif | 3265 #endif |
3266 c = *prog->regmust; | 3266 c = *prog->regmust; |
3267 s = line + col; | 3267 s = line + col; |
3268 while ((s = cstrchr(s, c)) != NULL) | 3268 |
3269 { | 3269 /* |
3270 if (cstrncmp(s, prog->regmust, &prog->regmlen) == 0) | 3270 * This is used very often, esp. for ":global". Use three versions of |
3271 break; /* Found it. */ | 3271 * the loop to avoid overhead of conditions. |
3272 mb_ptr_adv(s); | 3272 */ |
3273 } | 3273 if (!ireg_ic |
3274 #ifdef FEAT_MBYTE | |
3275 && !has_mbyte | |
3276 #endif | |
3277 ) | |
3278 while ((s = vim_strbyte(s, c)) != NULL) | |
3279 { | |
3280 if (cstrncmp(s, prog->regmust, &prog->regmlen) == 0) | |
3281 break; /* Found it. */ | |
3282 ++s; | |
3283 } | |
3284 #ifdef FEAT_MBYTE | |
3285 else if (!ireg_ic || (!enc_utf8 && mb_char2len(c) > 1)) | |
3286 while ((s = vim_strchr(s, c)) != NULL) | |
3287 { | |
3288 if (cstrncmp(s, prog->regmust, &prog->regmlen) == 0) | |
3289 break; /* Found it. */ | |
3290 mb_ptr_adv(s); | |
3291 } | |
3292 #endif | |
3293 else | |
3294 while ((s = cstrchr(s, c)) != NULL) | |
3295 { | |
3296 if (cstrncmp(s, prog->regmust, &prog->regmlen) == 0) | |
3297 break; /* Found it. */ | |
3298 mb_ptr_adv(s); | |
3299 } | |
3274 if (s == NULL) /* Not present. */ | 3300 if (s == NULL) /* Not present. */ |
3275 goto theend; | 3301 goto theend; |
3276 } | 3302 } |
3277 | 3303 |
3278 #ifdef HAVE_TRY_EXCEPT | 3304 #ifdef HAVE_TRY_EXCEPT |
3337 /* Messy cases: unanchored match. */ | 3363 /* Messy cases: unanchored match. */ |
3338 while (!got_int && !out_of_stack) | 3364 while (!got_int && !out_of_stack) |
3339 { | 3365 { |
3340 if (prog->regstart != NUL) | 3366 if (prog->regstart != NUL) |
3341 { | 3367 { |
3342 /* Skip until the char we know it must start with. */ | 3368 /* Skip until the char we know it must start with. |
3343 s = cstrchr(regline + col, prog->regstart); | 3369 * Used often, do some work to avoid call overhead. */ |
3370 if (!ireg_ic | |
3371 #ifdef FEAT_MBYTE | |
3372 && !has_mbyte | |
3373 #endif | |
3374 ) | |
3375 s = vim_strbyte(regline + col, prog->regstart); | |
3376 else | |
3377 s = cstrchr(regline + col, prog->regstart); | |
3344 if (s == NULL) | 3378 if (s == NULL) |
3345 { | 3379 { |
3346 retval = 0; | 3380 retval = 0; |
3347 break; | 3381 break; |
3348 } | 3382 } |
3373 if (out_of_stack) | 3407 if (out_of_stack) |
3374 EMSG(_(e_outofstack)); | 3408 EMSG(_(e_outofstack)); |
3375 | 3409 |
3376 #ifdef HAVE_SETJMP_H | 3410 #ifdef HAVE_SETJMP_H |
3377 inner_end: | 3411 inner_end: |
3378 ; | 3412 if (did_mch_startjmp) |
3413 mch_endjmp(); | |
3379 #endif | 3414 #endif |
3380 #ifdef HAVE_TRY_EXCEPT | 3415 #ifdef HAVE_TRY_EXCEPT |
3381 } | 3416 } |
3382 __except(EXCEPTION_EXECUTE_HANDLER) | 3417 __except(EXCEPTION_EXECUTE_HANDLER) |
3383 { | 3418 { |
3388 } | 3423 } |
3389 else | 3424 else |
3390 EMSG(_(e_complex)); | 3425 EMSG(_(e_complex)); |
3391 retval = 0L; | 3426 retval = 0L; |
3392 } | 3427 } |
3393 #endif | |
3394 #ifdef HAVE_SETJMP_H | |
3395 if (did_mch_startjmp) | |
3396 mch_endjmp(); | |
3397 #endif | 3428 #endif |
3398 | 3429 |
3399 theend: | 3430 theend: |
3400 /* Didn't find a match. */ | 3431 /* Didn't find a match. */ |
3401 vim_free(reg_tofree); | 3432 vim_free(reg_tofree); |