blob: 1d1d4ef80d4c556f40a9869285c7d562035d8a3d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#ifndef PERL_REGINLINE_H
/*
- regnext - dig the "next" pointer out of a node
*/
PERL_STATIC_INLINE
regnode *
Perl_regnext(pTHX_ const regnode *p)
{
I32 offset;
if (!p)
return(NULL);
if (OP(p) > REGNODE_MAX) { /* regnode.type is unsigned */
Perl_croak(aTHX_ "Corrupted regexp opcode %d > %d",
(int)OP(p), (int)REGNODE_MAX);
}
offset = (PL_regnode_off_by_arg[OP(p)] ? ARG(p) : NEXT_OFF(p));
if (offset == 0)
return(NULL);
return(regnode *)(p+offset);
}
/*
- regnode_after - find the node physically following p in memory,
taking into account the size of p as determined by OP(p), our
sizing data, and possibly the STR_SZ() macro.
*/
PERL_STATIC_INLINE
regnode *
Perl_regnode_after(pTHX_ const regnode *p, const bool varies)
{
assert(p);
const U8 op = OP(p);
assert(op < REGNODE_MAX);
const regnode *ret = p + NODE_STEP_REGNODE + PL_regnode_arg_len[op];
if (varies || PL_regnode_arg_len_varies[op])
ret += STR_SZ(STR_LEN(p));
return (regnode *)ret;
}
/* validate that the passed in node and extra length would match that
* returned by regnode_after() */
PERL_STATIC_INLINE
bool
Perl_check_regnode_after(pTHX_ const regnode *p, const STRLEN extra)
{
const regnode *nextoper = regnode_after((regnode *)p,FALSE);
const regnode *other = REGNODE_AFTER_PLUS(p, extra);
if (nextoper != other) {
return FALSE;
}
return TRUE;
}
#define PERL_REGINLINE_H
#endif
/*
* ex: set ts=8 sts=4 sw=4 et:
*/
|