Ap |void |push_scope
Amb |OP* |ref |NULLOK OP* o|I32 type
p |OP* |refkids |NULLOK OP* o|I32 type
-Ap |void |regdump |NN regexp* r
+Ap |void |regdump |NN const regexp* r
Ap |SV* |regclass_swash |NN const struct regnode *n|bool doinit|NULLOK SV **listsvp|NULLOK SV **altsvp
Ap |I32 |pregexec |NN regexp* prog|NN char* stringarg \
|NN char* strend|NN char* strbeg|I32 minend \
Es |regnode*|reg_node |NN struct RExC_state_t *state|U8 op
Es |regnode*|regpiece |NN struct RExC_state_t *state|NN I32 *flagp
Es |void |reginsert |NN struct RExC_state_t *state|U8 op|NN regnode *opnd
-Es |void |regoptail |NN struct RExC_state_t *state|NN regnode *p|NN regnode *val
-Es |void |regtail |NN struct RExC_state_t *state|NN regnode *p|NN regnode *val
+Es |void |regoptail |NN const struct RExC_state_t *state|NN regnode *p|NN const regnode *val
+Es |void |regtail |NN const struct RExC_state_t *state|NN regnode *p|NN const regnode *val
EsRn |char* |regwhite |NN char *p|NN const char *e
Es |char* |nextchar |NN struct RExC_state_t *state
# ifdef DEBUGGING
-Es |regnode*|dumpuntil |NN regexp *r|NN regnode *start|NN regnode *node \
+Es |regnode*|dumpuntil |NN const regexp *r|NN regnode *start|NN regnode *node \
|NULLOK regnode *last|NN SV* sv|I32 l
Es |void |put_byte |NN SV* sv|int c
# endif
-Es |void |scan_commit |NN struct RExC_state_t* state|NN struct scan_data_t *data
-Esn |void |cl_anything |NN struct RExC_state_t* state|NN struct regnode_charclass_class *cl
+Es |void |scan_commit |NN const struct RExC_state_t* state|NN struct scan_data_t *data
+Esn |void |cl_anything |NN const struct RExC_state_t* state|NN struct regnode_charclass_class *cl
EsRn |int |cl_is_anything |NN const struct regnode_charclass_class *cl
-Esn |void |cl_init |NN struct RExC_state_t* state|NN struct regnode_charclass_class *cl
-Esn |void |cl_init_zero |NN struct RExC_state_t* state|NN struct regnode_charclass_class *cl
+Esn |void |cl_init |NN const struct RExC_state_t* state|NN struct regnode_charclass_class *cl
+Esn |void |cl_init_zero |NN const struct RExC_state_t* state|NN struct regnode_charclass_class *cl
Esn |void |cl_and |NN struct regnode_charclass_class *cl \
|NN const struct regnode_charclass_class *and_with
-Esn |void |cl_or |NN struct RExC_state_t* state|NN struct regnode_charclass_class *cl \
+Esn |void |cl_or |NN const struct RExC_state_t* state|NN struct regnode_charclass_class *cl \
|NN const struct regnode_charclass_class *or_with
Es |I32 |study_chunk |NN struct RExC_state_t* state|NN regnode **scanp \
|NN I32 *deltap|NN regnode *last|NULLOK struct scan_data_t *data \
ERs |bool |reginclass |NN const regnode *n|NN const U8 *p|NULLOK STRLEN *lenp\
|bool do_utf8sv_is_utf8
Es |CHECKPOINT|regcppush |I32 parenfloor
-Es |char* |regcppop |NN regexp *rex
+Es |char* |regcppop |NN const regexp *rex
ERsn |U8* |reghop3 |NN U8 *pos|I32 off|NN U8 *lim
ERsn |U8* |reghopmaybe3 |NN U8 *pos|I32 off|NN U8 *lim
-ERs |char* |find_byclass |NN regexp * prog|NN regnode *c|NN char *s|NN const char *strend|I32 norun
+ERs |char* |find_byclass |NN regexp * prog|NN const regnode *c|NN char *s|NN const char *strend|I32 norun
Es |void |to_utf8_substr |NN regexp * prog
Es |void |to_byte_substr |NN regexp * prog
#endif
PERL_CALLCONV void Perl_push_scope(pTHX);
/* PERL_CALLCONV OP* ref(pTHX_ OP* o, I32 type); */
PERL_CALLCONV OP* Perl_refkids(pTHX_ OP* o, I32 type);
-PERL_CALLCONV void Perl_regdump(pTHX_ regexp* r)
+PERL_CALLCONV void Perl_regdump(pTHX_ const regexp* r)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV SV* Perl_regclass_swash(pTHX_ const struct regnode *n, bool doinit, SV **listsvp, SV **altsvp)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_3);
-STATIC void S_regoptail(pTHX_ struct RExC_state_t *state, regnode *p, regnode *val)
+STATIC void S_regoptail(pTHX_ const struct RExC_state_t *state, regnode *p, const regnode *val)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3);
-STATIC void S_regtail(pTHX_ struct RExC_state_t *state, regnode *p, regnode *val)
+STATIC void S_regtail(pTHX_ const struct RExC_state_t *state, regnode *p, const regnode *val)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3);
__attribute__nonnull__(pTHX_1);
# ifdef DEBUGGING
-STATIC regnode* S_dumpuntil(pTHX_ regexp *r, regnode *start, regnode *node, regnode *last, SV* sv, I32 l)
+STATIC regnode* S_dumpuntil(pTHX_ const regexp *r, regnode *start, regnode *node, regnode *last, SV* sv, I32 l)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3)
__attribute__nonnull__(pTHX_1);
# endif
-STATIC void S_scan_commit(pTHX_ struct RExC_state_t* state, struct scan_data_t *data)
+STATIC void S_scan_commit(pTHX_ const struct RExC_state_t* state, struct scan_data_t *data)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
-STATIC void S_cl_anything(struct RExC_state_t* state, struct regnode_charclass_class *cl)
+STATIC void S_cl_anything(const struct RExC_state_t* state, struct regnode_charclass_class *cl)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
__attribute__warn_unused_result__
__attribute__nonnull__(1);
-STATIC void S_cl_init(struct RExC_state_t* state, struct regnode_charclass_class *cl)
+STATIC void S_cl_init(const struct RExC_state_t* state, struct regnode_charclass_class *cl)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-STATIC void S_cl_init_zero(struct RExC_state_t* state, struct regnode_charclass_class *cl)
+STATIC void S_cl_init_zero(const struct RExC_state_t* state, struct regnode_charclass_class *cl)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-STATIC void S_cl_or(struct RExC_state_t* state, struct regnode_charclass_class *cl, const struct regnode_charclass_class *or_with)
+STATIC void S_cl_or(const struct RExC_state_t* state, struct regnode_charclass_class *cl, const struct regnode_charclass_class *or_with)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
__attribute__nonnull__(pTHX_2);
STATIC CHECKPOINT S_regcppush(pTHX_ I32 parenfloor);
-STATIC char* S_regcppop(pTHX_ regexp *rex)
+STATIC char* S_regcppop(pTHX_ const regexp *rex)
__attribute__nonnull__(pTHX_1);
STATIC U8* S_reghop3(U8 *pos, I32 off, U8 *lim)
__attribute__nonnull__(1)
__attribute__nonnull__(3);
-STATIC char* S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, const char *strend, I32 norun)
+STATIC char* S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, const char *strend, I32 norun)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
floating substrings if needed. */
STATIC void
-S_scan_commit(pTHX_ RExC_state_t *pRExC_state, scan_data_t *data)
+S_scan_commit(pTHX_ const RExC_state_t *pRExC_state, scan_data_t *data)
{
const STRLEN l = CHR_SVLEN(data->last_found);
const STRLEN old_l = CHR_SVLEN(*data->longest);
SvCUR_set(data->last_found, 0);
{
SV * const sv = data->last_found;
- MAGIC * const mg =
- SvUTF8(sv) && SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : NULL;
- if (mg)
- mg->mg_len = 0;
+ if (SvUTF8(sv) && SvMAGICAL(sv)) {
+ MAGIC * const mg = mg_find(sv, PERL_MAGIC_utf8);
+ if (mg)
+ mg->mg_len = 0;
+ }
}
data->last_end = -1;
data->flags &= ~SF_BEFORE_EOL;
/* Can match anything (initialization) */
STATIC void
-S_cl_anything(RExC_state_t *pRExC_state, struct regnode_charclass_class *cl)
+S_cl_anything(const RExC_state_t *pRExC_state, struct regnode_charclass_class *cl)
{
ANYOF_CLASS_ZERO(cl);
ANYOF_BITMAP_SETALL(cl);
/* Can match anything (initialization) */
STATIC void
-S_cl_init(RExC_state_t *pRExC_state, struct regnode_charclass_class *cl)
+S_cl_init(const RExC_state_t *pRExC_state, struct regnode_charclass_class *cl)
{
Zero(cl, 1, struct regnode_charclass_class);
cl->type = ANYOF;
}
STATIC void
-S_cl_init_zero(RExC_state_t *pRExC_state, struct regnode_charclass_class *cl)
+S_cl_init_zero(const RExC_state_t *pRExC_state, struct regnode_charclass_class *cl)
{
Zero(cl, 1, struct regnode_charclass_class);
cl->type = ANYOF;
/* 'OR' a given class with another one. Can create false positives */
/* We assume that cl is not inverted */
STATIC void
-S_cl_or(RExC_state_t *pRExC_state, struct regnode_charclass_class *cl, const struct regnode_charclass_class *or_with)
+S_cl_or(const RExC_state_t *pRExC_state, struct regnode_charclass_class *cl, const struct regnode_charclass_class *or_with)
{
if (or_with->flags & ANYOF_INVERT) {
/* We do not use
/* I smell either [: or [= or [. -- POSIX has been here, right? */
POSIXCC(UCHARAT(RExC_parse))) {
const char c = UCHARAT(RExC_parse);
- char* s = RExC_parse++;
+ char* const s = RExC_parse++;
while (RExC_parse < RExC_end && UCHARAT(RExC_parse) != c)
RExC_parse++;
n--;
}
}
- if (value == 'p')
- Perl_sv_catpvf(aTHX_ listsv,
- "+utf8::%.*s\n", (int)n, RExC_parse);
- else
- Perl_sv_catpvf(aTHX_ listsv,
- "!utf8::%.*s\n", (int)n, RExC_parse);
+ Perl_sv_catpvf(aTHX_ listsv, "%cutf8::%.*s\n",
+ (value=='p' ? '+' : '!'), (int)n, RExC_parse);
}
RExC_parse = e + 1;
ANYOF_FLAGS(ret) |= ANYOF_UNICODE;
if (range) {
if (!SIZE_ONLY) {
if (ckWARN(WARN_REGEXP)) {
- int w =
+ const int w =
RExC_parse >= rangebegin ?
RExC_parse - rangebegin : 0;
vWARN4(RExC_parse,
"False [] range \"%*.*s\"",
- w,
- w,
- rangebegin);
+ w, w, rangebegin);
}
if (prevvalue < 256) {
ANYOF_BITMAP_SET(ret, prevvalue);
RExC_parse - rangebegin : 0;
vWARN4(RExC_parse,
"False [] range \"%*.*s\"",
- w,
- w,
- rangebegin);
+ w, w, rangebegin);
}
if (!SIZE_ONLY)
ANYOF_BITMAP_SET(ret, '-');
}
if (!SIZE_ONLY) {
- AV *av = newAV();
+ AV * const av = newAV();
SV *rv;
/* The 0th element stores the character class description
STATIC char*
S_nextchar(pTHX_ RExC_state_t *pRExC_state)
{
- char* retval = RExC_parse++;
+ char* const retval = RExC_parse++;
for (;;) {
if (*RExC_parse == '(' && RExC_parse[1] == '?' &&
/*
- regtail - set the next-pointer at the end of a node chain of p to val.
*/
+/* TODO: All three parms should be const */
STATIC void
-S_regtail(pTHX_ RExC_state_t *pRExC_state, regnode *p, regnode *val)
+S_regtail(pTHX_ const RExC_state_t *pRExC_state, regnode *p, const regnode *val)
{
dVAR;
register regnode *scan;
/*
- regoptail - regtail on operand of first argument; nop if operandless
*/
+/* TODO: All three parms should be const */
STATIC void
-S_regoptail(pTHX_ RExC_state_t *pRExC_state, regnode *p, regnode *val)
+S_regoptail(pTHX_ const RExC_state_t *pRExC_state, regnode *p, const regnode *val)
{
dVAR;
/* "Operandless" and "op != BRANCH" are synonymous in practice. */
- regdump - dump a regexp onto Perl_debug_log in vaguely comprehensible form
*/
void
-Perl_regdump(pTHX_ regexp *r)
+Perl_regdump(pTHX_ const regexp *r)
{
#ifdef DEBUGGING
dVAR;
STATIC regnode *
-S_dumpuntil(pTHX_ regexp *r, regnode *start, regnode *node, regnode *last,
+S_dumpuntil(pTHX_ const regexp *r, regnode *start, regnode *node, regnode *last,
SV* sv, I32 l)
{
dVAR;
node->flags ? " EVAL mode" : "");
for (word_idx=0; word_idx < arry_len; word_idx++) {
- SV **elem_ptr=av_fetch(trie->words,word_idx,0);
+ SV ** const elem_ptr = av_fetch(trie->words,word_idx,0);
if (elem_ptr) {
PerlIO_printf(Perl_debug_log, "%*s<%s%s%s>\n",
(int)(2*(l+4)), "",
(IV)(cp), (IV)PL_savestack_ix) : 0); regcpblow(cp)
STATIC char *
-S_regcppop(pTHX_ regexp *rex)
+S_regcppop(pTHX_ const regexp *rex)
{
dVAR;
I32 i;
- U32 paren = 0;
char *input;
GET_RE_DEBUG_FLAGS_DECL;
for (i -= (REGCP_OTHER_ELEMS - REGCP_FRAME_ELEMS);
i > 0; i -= REGCP_PAREN_ELEMS) {
I32 tmps;
- paren = (U32)SSPOPINT;
+ U32 paren = (U32)SSPOPINT;
PL_reg_start_tmp[paren] = (char *) SSPOPPTR;
PL_regstartp[paren] = SSPOPINT;
tmps = SSPOPINT;
* building DynaLoader will fail:
* "Error: '*' not in typemap in DynaLoader.xs, line 164"
* --jhi */
- for (paren = *PL_reglastparen + 1; (I32)paren <= rex->nparens; paren++) {
- if ((I32)paren > PL_regsize)
- PL_regstartp[paren] = -1;
- PL_regendp[paren] = -1;
+ for (i = *PL_reglastparen + 1; i <= rex->nparens; i++) {
+ if (i > PL_regsize)
+ PL_regstartp[i] = -1;
+ PL_regendp[i] = -1;
}
#endif
return input;
/* We know what class REx starts with. Try to find this position... */
STATIC char *
-S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, const char *strend, I32 norun)
+S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, const char *strend, I32 norun)
{
dVAR;
const I32 doevery = (prog->reganch & ROPT_SKIP) == 0;
S_regtry(pTHX_ regexp *prog, char *startpos)
{
dVAR;
- register I32 i;
register I32 *sp;
register I32 *ep;
CHECKPOINT lastcp;
sp = prog->startp;
ep = prog->endp;
if (prog->nparens) {
+ register I32 i;
for (i = prog->nparens; i > (I32)*PL_reglastparen; i--) {
*++sp = -1;
*++ep = -1;
if ( st->u.trie.accepted == 1 ) {
DEBUG_EXECUTE_r({
- SV **tmp = av_fetch( trie->words, st->u.trie.accept_buff[ 0 ].wordnum-1, 0 );
+ SV ** const tmp = av_fetch( trie->words, st->u.trie.accept_buff[ 0 ].wordnum-1, 0 );
PerlIO_printf( Perl_debug_log,
"%*s %sonly one match : #%d <%s>%s\n",
REPORT_CODE_OFF+PL_regindent*2, "", PL_colors[4],
restore_pos(pTHX_ void *arg)
{
dVAR;
- regexp *rex = (regexp *)arg;
+ regexp * const rex = (regexp *)arg;
if (PL_reg_eval_set) {
if (PL_reg_oldsaved) {
rex->subbeg = PL_reg_oldsaved;
S_to_utf8_substr(pTHX_ register regexp *prog)
{
if (prog->float_substr && !prog->float_utf8) {
- SV* sv;
- prog->float_utf8 = sv = newSVsv(prog->float_substr);
+ SV* const sv = newSVsv(prog->float_substr);
+ prog->float_utf8 = sv;
sv_utf8_upgrade(sv);
if (SvTAIL(prog->float_substr))
SvTAIL_on(sv);
prog->check_utf8 = sv;
}
if (prog->anchored_substr && !prog->anchored_utf8) {
- SV* sv;
- prog->anchored_utf8 = sv = newSVsv(prog->anchored_substr);
+ SV* const sv = newSVsv(prog->anchored_substr);
+ prog->anchored_utf8 = sv;
sv_utf8_upgrade(sv);
if (SvTAIL(prog->anchored_substr))
SvTAIL_on(sv);
{
dVAR;
if (prog->float_utf8 && !prog->float_substr) {
- SV* sv;
- prog->float_substr = sv = newSVsv(prog->float_utf8);
+ SV* sv = newSVsv(prog->float_utf8);
+ prog->float_substr = sv;
if (sv_utf8_downgrade(sv, TRUE)) {
if (SvTAIL(prog->float_utf8))
SvTAIL_on(sv);
prog->check_substr = sv;
}
if (prog->anchored_utf8 && !prog->anchored_substr) {
- SV* sv;
- prog->anchored_substr = sv = newSVsv(prog->anchored_utf8);
+ SV* sv = newSVsv(prog->anchored_utf8);
+ prog->anchored_substr = sv;
if (sv_utf8_downgrade(sv, TRUE)) {
if (SvTAIL(prog->anchored_utf8))
SvTAIL_on(sv);