| 1 |
|
| /* vi: set ft=c : */ |
| 2 |
|
| |
| 3 |
|
| #define sv_regexp_match(sv, rx) S_sv_regexp_match(aTHX_ sv, rx) |
| 4 |
4 |
| static bool S_sv_regexp_match(pTHX_ SV *sv, REGEXP *rx) |
| 5 |
|
| { |
| 6 |
|
| STRLEN len; |
| 7 |
|
| /* These don't get modified, but CALLREGEXEC() doesn't take consts. */ |
| 8 |
4 |
| char *strbeg = SvPV(sv, len); |
| 9 |
4 |
| char *strend = strbeg + len; |
| 10 |
|
| |
| 11 |
4 |
| STRLEN minlen = RX_MINLEN(rx); |
| 12 |
4 |
▶ | if(minlen && len < minlen) |
Branch: 2 branches
| Branch | True | False | Total |
| if(minlen && len < minlen) |
4 |
0 |
4 |
| if(minlen && len < minlen) |
0 |
4 |
4 |
|
| 13 |
|
| /* string is already shorter than the shortest possible match */ |
| 14 |
0 |
| return false; |
| 15 |
|
| |
| 16 |
|
| /* Entirely unclear from docs what data or flags should be but in practice |
| 17 |
|
| * it turns out that NULL/0 seems to work fine. |
| 18 |
|
| * minend can just be 1. |
| 19 |
|
| */ |
| 20 |
4 |
| I32 ret = CALLREGEXEC(rx, strbeg, strend, strbeg, 1, sv, NULL, 0); |
| 21 |
4 |
| return (ret != 0); |
| 22 |
|
| } |