Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 regcomp.c - TRE POSIX compatible regex compilation functions. | 2 regcomp.c - TRE POSIX compatible regex compilation functions. |
| 3 | 3 |
| 4 Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi> | 4 Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi> |
| 5 All rights reserved. | 5 All rights reserved. |
| 6 | 6 |
| 7 Redistribution and use in source and binary forms, with or without | 7 Redistribution and use in source and binary forms, with or without |
| 8 modification, are permitted provided that the following conditions | 8 modification, are permitted provided that the following conditions |
| 9 are met: | 9 are met: |
| 10 | 10 |
| (...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2305 if (p2->position == prev_p2_pos) { | 2305 if (p2->position == prev_p2_pos) { |
| 2306 p2++; | 2306 p2++; |
| 2307 continue; | 2307 continue; |
| 2308 } | 2308 } |
| 2309 prev_p2_pos = p2->position; | 2309 prev_p2_pos = p2->position; |
| 2310 /* Set `trans' to point to the next unused transition from | 2310 /* Set `trans' to point to the next unused transition from |
| 2311 position `p1->position'. */ | 2311 position `p1->position'. */ |
| 2312 trans = transitions + offs[p1->position]; | 2312 trans = transitions + offs[p1->position]; |
| 2313 while (trans->state != NULL) { | 2313 while (trans->state != NULL) { |
| 2314 #if 0 | 2314 #if 0 |
| 2315 » » /* If we find a previous transition from `p1->position' to | 2315 /* If we find a previous transition from `p1->position' to |
| 2316 » » `p2->position', it is overwritten. This can happen only | 2316 `p2->position', it is overwritten. This can happen only |
| 2317 » » if there are nested loops in the regexp, like in "((a)*)*". | 2317 if there are nested loops in the regexp, like in "((a)*)*". |
| 2318 » » In POSIX.2 repetition using the outer loop is always | 2318 In POSIX.2 repetition using the outer loop is always |
| 2319 » » preferred over using the inner loop.» Therefore the | 2319 preferred over using the inner loop.» Therefore the |
|
viettrungluu
2016/02/19 17:21:53
You still have a tab!
kulakowski
2016/02/19 18:03:22
Yeah. I said in the message that I didn't get ones
| |
| 2320 » » transition for the inner loop is useless and can be thrown | 2320 transition for the inner loop is useless and can be thrown |
| 2321 » » away. */ | 2321 away. */ |
| 2322 » » /* XXX - The same position is used for all nodes in a bracket | 2322 /* XXX - The same position is used for all nodes in a bracket |
| 2323 » » expression, so this optimization cannot be used (it will | 2323 expression, so this optimization cannot be used (it will |
| 2324 » » break bracket expressions) unless I figure out a way to | 2324 break bracket expressions) unless I figure out a way to |
| 2325 » » detect it here. */ | 2325 detect it here. */ |
| 2326 » » if (trans->state_id == p2->position) | 2326 if (trans->state_id == p2->position) { |
| 2327 » » { | 2327 break; |
| 2328 » » break; | 2328 } |
| 2329 » » } | |
| 2330 #endif | 2329 #endif |
| 2331 trans++; | 2330 trans++; |
| 2332 } | 2331 } |
| 2333 | 2332 |
| 2334 if (trans->state == NULL) | 2333 if (trans->state == NULL) |
| 2335 (trans + 1)->state = NULL; | 2334 (trans + 1)->state = NULL; |
| 2336 /* Use the character ranges, assertions, etc. from `p1' for | 2335 /* Use the character ranges, assertions, etc. from `p1' for |
| 2337 the transition from `p1' to `p2'. */ | 2336 the transition from `p1' to `p2'. */ |
| 2338 trans->code_min = p1->code_min; | 2337 trans->code_min = p1->code_min; |
| 2339 trans->code_max = p1->code_max; | 2338 trans->code_max = p1->code_max; |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2726 } | 2725 } |
| 2727 | 2726 |
| 2728 if (tnfa->tag_directions) | 2727 if (tnfa->tag_directions) |
| 2729 xfree(tnfa->tag_directions); | 2728 xfree(tnfa->tag_directions); |
| 2730 if (tnfa->firstpos_chars) | 2729 if (tnfa->firstpos_chars) |
| 2731 xfree(tnfa->firstpos_chars); | 2730 xfree(tnfa->firstpos_chars); |
| 2732 if (tnfa->minimal_tags) | 2731 if (tnfa->minimal_tags) |
| 2733 xfree(tnfa->minimal_tags); | 2732 xfree(tnfa->minimal_tags); |
| 2734 xfree(tnfa); | 2733 xfree(tnfa); |
| 2735 } | 2734 } |
| OLD | NEW |