File Coverage

hax/sv_regexp_match.c.inc
Criterion Covered Total %
statement 7 7 100.0
branch 4 6 66.6
condition n/a
subroutine n/a
pod n/a
total 11 13 84.6


line stmt bran cond sub pod time code
1             /* vi: set ft=c : */
2              
3             #define sv_regexp_match(sv, rx) S_sv_regexp_match(aTHX_ sv, rx)
4 6           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 6           char *strbeg = SvPV(sv, len);
9 6 50         char *strend = strbeg + len;
10              
11 6           STRLEN minlen = RX_MINLEN(rx);
12 6 50         if(minlen && len < minlen)
    100          
13             /* string is already shorter than the shortest possible match */
14             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 5           I32 ret = CALLREGEXEC(rx, strbeg, strend, strbeg, 1, sv, NULL, 0);
21 5           return (ret != 0);
22             }