From: Andy Lester Date: Thu, 3 May 2007 00:45:54 +0000 (-0500) Subject: The revenge of the consts X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c86f7df56cc91b3d77b0e549030650319f540a6b;p=p5sagit%2Fp5-mst-13.2.git The revenge of the consts Message-ID: <20070503054554.GA30975@petdance.com> p4raw-id: //depot/perl@31123 --- diff --git a/av.c b/av.c index 39b4b7d..9361e28 100644 --- a/av.c +++ b/av.c @@ -656,10 +656,9 @@ Perl_av_unshift(pTHX_ register AV *av, register I32 num) } if (num) { register SV **ary; - I32 slide; - i = AvFILLp(av); + const I32 i = AvFILLp(av); /* Create extra elements */ - slide = i > 0 ? i : 0; + const I32 slide = i > 0 ? i : 0; num += slide; av_extend(av, i + num); AvFILLp(av) += num; diff --git a/embed.fnc b/embed.fnc index 70cfbe5..5211577 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1351,7 +1351,7 @@ Es |STRLEN |reguni |NN const struct RExC_state_t *state|UV uv|NN char *s Es |regnode*|regclass |NN struct RExC_state_t *state|U32 depth ERsn |I32 |regcurly |NN const char * Es |regnode*|reg_node |NN struct RExC_state_t *state|U8 op -Es |UV |reg_recode |const char value|NULLOK SV **encp +Es |UV |reg_recode |const char value|NN SV **encp Es |regnode*|regpiece |NN struct RExC_state_t *state|NN I32 *flagp|U32 depth Es |regnode*|reg_namedseq |NN struct RExC_state_t *state|NULLOK UV *valuep Es |void |reginsert |NN struct RExC_state_t *state|U8 op|NN regnode *opnd|U32 depth diff --git a/numeric.c b/numeric.c index 20fd7bd..34264f3 100644 --- a/numeric.c +++ b/numeric.c @@ -953,10 +953,9 @@ Perl_my_atof2(pTHX_ const char* orig, NV* value) else if (!seen_dp && GROK_NUMERIC_RADIX(&s, send)) { seen_dp = 1; if (sig_digits > MAX_SIG_DIGITS) { - ++s; - while (isDIGIT(*s)) { + do { ++s; - } + } while (isDIGIT(*s)); break; } } diff --git a/proto.h b/proto.h index 85f2c11..1199789 100644 --- a/proto.h +++ b/proto.h @@ -3650,7 +3650,9 @@ STATIC I32 S_regcurly(const char *) STATIC regnode* S_reg_node(pTHX_ struct RExC_state_t *state, U8 op) __attribute__nonnull__(pTHX_1); -STATIC UV S_reg_recode(pTHX_ const char value, SV **encp); +STATIC UV S_reg_recode(pTHX_ const char value, SV **encp) + __attribute__nonnull__(pTHX_2); + STATIC regnode* S_regpiece(pTHX_ struct RExC_state_t *state, I32 *flagp, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); diff --git a/regcomp.c b/regcomp.c index 6b123c3..4729780 100644 --- a/regcomp.c +++ b/regcomp.c @@ -6434,8 +6434,7 @@ S_reg_recode(pTHX_ const char value, SV **encp) { STRLEN numlen = 1; SV * const sv = sv_2mortal(newSVpvn(&value, numlen)); - const char * const s = encp && *encp ? sv_recode_to_utf8(sv, *encp) - : SvPVX(sv); + const char * const s = *encp ? sv_recode_to_utf8(sv, *encp) : SvPVX(sv); const STRLEN newlen = SvCUR(sv); UV uv = UNICODE_REPLACEMENT; @@ -6446,8 +6445,7 @@ S_reg_recode(pTHX_ const char value, SV **encp) if (!newlen || numlen != newlen) { uv = UNICODE_REPLACEMENT; - if (encp) - *encp = NULL; + *encp = NULL; } return uv; }