else {
@args = split /\s*\|\s*/, $_;
}
- s/\bNN\b\s+// for @args;
+ s/\b(NN|NULLOK)\b\s+//g for @args;
print $F $function->(@args);
}
print $F $trailer if $trailer;
:
: Pointer parameters that must not be passed NULLs should be prefixed with NN.
:
+: Pointer parameters that may be NULL should be prefixed with NULLOK. This has
+: no effect on output yet. It's a notation for the maintainers to know "I have
+: defined whether NULL is OK or not" rather than having neither NULL or NULLOK,
+: which is ambiguous.
+:
: Individual flags may be separated by whitespace.
:
: New global functions should be added at the end for binary compatibility
p |I32 |apply |I32 type|SV** mark|SV** sp
ApM |void |apply_attrs_string|const char *stashpv|CV *cv|const char *attrstr|STRLEN len
Apd |void |av_clear |AV* ar
-ApdR |SV* |av_delete |AV* ar|I32 key|I32 flags
+Apd |SV* |av_delete |AV* ar|I32 key|I32 flags
ApdR |bool |av_exists |AV* ar|I32 key
Apd |void |av_extend |NN AV* ar|I32 key
pR |AV* |av_fake |I32 size|NN SV** svp
Apd |void |av_fill |AV* ar|I32 fill
ApdR |I32 |av_len |const AV* ar
ApdR |AV* |av_make |I32 size|NN SV** svp
-ApdR |SV* |av_pop |AV* ar
+Apd |SV* |av_pop |AV* ar
Apd |void |av_push |AV* ar|SV* val
p |void |av_reify |AV* ar
ApdR |SV* |av_shift |AV* ar
Ap |void |gv_fullname |SV* sv|const GV* gv
Apmb |void |gv_fullname3 |SV* sv|const GV* gv|const char* prefix
Ap |void |gv_fullname4 |SV* sv|const GV* gv|const char* prefix|bool keepmain
-Ap |void |gv_init |NN GV* gv|NN HV* stash|NN const char* name \
- |STRLEN len|int multi
+Ap |void |gv_init |NN GV* gv|HV* stash|NN const char* name|STRLEN len|int multi
Apd |HV* |gv_stashpv |const char* name|I32 create
Apd |HV* |gv_stashpvn |const char* name|U32 namelen|I32 create
Apd |HV* |gv_stashsv |SV* sv|I32 create
Apda |SV* |newSVpvn_share |const char* s|I32 len|U32 hash
Afpda |SV* |newSVpvf |const char* pat|...
Ap |SV* |vnewSVpvf |const char* pat|va_list* args
-Apda |SV* |newSVrv |SV* rv|const char* classname
-Apda |SV* |newSVsv |SV* old
+Apda |SV* |newSVrv |NN SV* rv|NULLOK const char* classname
+Apda |SV* |newSVsv |NULLOK SV* old
Apa |OP* |newUNOP |I32 type|I32 flags|OP* first
Apa |OP* |newWHILEOP |I32 flags|I32 debuggable|LOOP* loop \
|I32 whileline|OP* expr|OP* block|OP* cont \
|I32 namlen
Apd |MAGIC *|sv_magicext |NN SV* sv|SV* obj|int how|const MGVTBL *vtbl \
|const char* name|I32 namlen
-Apd |SV* |sv_mortalcopy |NN SV* oldsv
+ApdaR |SV* |sv_mortalcopy |NULLOK SV* oldsv
ApdR |SV* |sv_newmortal
-Apd |SV* |sv_newref |SV* sv
+Apd |SV* |sv_newref |NULLOK SV* sv
Ap |char* |sv_peek |SV* sv
Apd |void |sv_pos_u2b |SV* sv|NN I32* offsetp|I32* lenp
Apd |void |sv_pos_b2u |SV* sv|NN I32* offsetp
Apd |SV* |sv_setref_iv |SV* rv|const char* classname|IV iv
Apd |SV* |sv_setref_uv |SV* rv|const char* classname|UV uv
Apd |SV* |sv_setref_nv |SV* rv|const char* classname|NV nv
-Apd |SV* |sv_setref_pv |SV* rv|const char* classname|void* pv
-Apd |SV* |sv_setref_pvn |SV* rv|const char* classname|char* pv \
- |STRLEN n
+Apd |SV* |sv_setref_pv |SV* rv|const char* classname|NULLOK void* pv
+Apd |SV* |sv_setref_pvn |SV* rv|const char* classname|NN const char* pv|STRLEN n
Apd |void |sv_setpv |SV* sv|const char* ptr
Apd |void |sv_setpvn |NN SV* sv|const char* ptr|STRLEN len
Amdb |void |sv_setsv |SV* dsv|SV* ssv
Ap |MGVTBL*|get_vtbl |int vtbl_id
Ap |char* |pv_display |SV *dsv|const char *pv|STRLEN cur|STRLEN len \
|STRLEN pvlim
-Afp |void |dump_indent |I32 level|PerlIO *file|const char* pat|...
-Ap |void |dump_vindent |I32 level|PerlIO *file|const char* pat \
+Afp |void |dump_indent |I32 level|NN PerlIO *file|const char* pat|...
+Ap |void |dump_vindent |I32 level|NN PerlIO *file|const char* pat \
|va_list *args
-Ap |void |do_gv_dump |I32 level|PerlIO *file|const char *name|GV *sv
-Ap |void |do_gvgv_dump |I32 level|PerlIO *file|const char *name|GV *sv
-Ap |void |do_hv_dump |I32 level|PerlIO *file|const char *name|HV *sv
-Ap |void |do_magic_dump |I32 level|PerlIO *file|const MAGIC *mg|I32 nest \
+Ap |void |do_gv_dump |I32 level|NN PerlIO *file|const char *name|GV *sv
+Ap |void |do_gvgv_dump |I32 level|NN PerlIO *file|const char *name|GV *sv
+Ap |void |do_hv_dump |I32 level|NN PerlIO *file|const char *name|HV *sv
+Ap |void |do_magic_dump |I32 level|NN PerlIO *file|const MAGIC *mg|I32 nest \
|I32 maxnest|bool dumpops|STRLEN pvlim
-Ap |void |do_op_dump |I32 level|PerlIO *file|const OP *o
-Ap |void |do_pmop_dump |I32 level|PerlIO *file|const PMOP *pm
-Ap |void |do_sv_dump |I32 level|PerlIO *file|SV *sv|I32 nest \
+Ap |void |do_op_dump |I32 level|NN PerlIO *file|const OP *o
+Ap |void |do_pmop_dump |I32 level|NN PerlIO *file|const PMOP *pm
+Ap |void |do_sv_dump |I32 level|NN PerlIO *file|NULLOK SV *sv|I32 nest \
|I32 maxnest|bool dumpops|STRLEN pvlim
-Ap |void |magic_dump |const MAGIC *mg
+Ap |void |magic_dump |NULLOK const MAGIC *mg
Ap |void |reginitcolors
Apd |char* |sv_2pv_nolen |SV* sv
Apd |char* |sv_2pvutf8_nolen|SV* sv
s |void |del_he |NN HE *p
sa |HEK* |save_hek_flags |NN const char *str|I32 len|U32 hash|int flags
s |void |hv_magic_check |NN HV *hv|NN bool *needs_copy|NN bool *needs_store
-s |void |unshare_hek_or_pvn|const HEK* hek|const char* str|I32 len|U32 hash
-sR |HEK* |share_hek_flags|const char* sv|I32 len|U32 hash|int flags
+s |void |unshare_hek_or_pvn|NULLOK const HEK* hek|NULLOK const char* str|I32 len|U32 hash
+sR |HEK* |share_hek_flags|NN const char* sv|I32 len|U32 hash|int flags
rs |void |hv_notallowed |int flags|NN const char *key|I32 klen|NN const char *msg
s |struct xpvhv_aux*|hv_auxinit|NN HV *hv
sM |SV* |hv_delete_common|HV* tb|SV* key_sv|const char* key|STRLEN klen|int k_flags|I32 d_flags|U32 hash
#endif
#if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT)
-s |IV |asIV |SV* sv
-s |UV |asUV |SV* sv
-s |void |sv_unglob |SV* sv
-s |void |not_a_number |SV *sv
-s |I32 |visit |SVFUNC_t f|U32 flags|U32 mask
-s |void |sv_add_backref |SV *tsv|SV *sv
-s |void |sv_del_backref |SV *sv
-s |SV * |varname |GV *gv|NN const char *gvtype|PADOFFSET targ \
- |SV *keyname|I32 aindex|int subscript_type
+sR |IV |asIV |NN SV* sv
+sR |UV |asUV |NN SV* sv
+s |void |sv_unglob |NN SV* sv
+s |void |not_a_number |NN SV *sv
+s |I32 |visit |NN SVFUNC_t f|U32 flags|U32 mask
+s |void |sv_add_backref |NN SV *tsv|NN SV *sv
+s |void |sv_del_backref |NN SV *sv
+sR |SV * |varname |NULLOK GV *gv|NN const char *gvtype|PADOFFSET targ \
+ |NULLOK SV *keyname|I32 aindex|int subscript_type
# ifdef DEBUGGING
s |void |del_sv |SV *p
# endif
START_EXTERN_C
-Apd |void |sv_setsv_flags |NN SV* dsv|SV* ssv|I32 flags
+Apd |void |sv_setsv_flags |NN SV* dsv|NULLOK SV* ssv|I32 flags
Apd |void |sv_catpvn_flags|NN SV* sv|NN const char* ptr|STRLEN len|I32 flags
Apd |void |sv_catsv_flags |NN SV* dsv|SV* ssv|I32 flags
Apd |STRLEN |sv_utf8_upgrade_flags|NN SV *sv|I32 flags
for my $arg ( @args ) {
++$n;
push( @nonnull, $n ) if ( $arg =~ s/\s*\bNN\b\s+// );
+ $arg =~ s/\s*\bNULLOK\b\s+//; # strip NULLOK with no effect
}
$ret .= join ", ", @args;
}
Perl_dump_indent Perl_dump_vindent
Perl_default_protect Perl_vdefault_protect
);
+
+# ex: set ts=8 sts=4 sw=4 noet:
else if (shared) {
/* This is hek_dup inlined, which seems to be important for speed
reasons. */
- HEK *source = HeKEY_hek(e);
+ HEK * const source = HeKEY_hek(e);
HEK *shared = (HEK*)ptr_table_fetch(PL_ptr_table, source);
if (shared) {
S_hv_notallowed(pTHX_ int flags, const char *key, I32 klen,
const char *msg)
{
- SV *sv = sv_newmortal();
+ SV * const sv = sv_newmortal();
if (!(flags & HVhek_FREEKEY)) {
sv_setpvn(sv, key, klen);
}
STATIC HEK *
S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
{
- register XPVHV* xhv;
register HE *entry;
register HE **oentry;
I32 found = 0;
Can't rehash the shared string table, so not sure if it's worth
counting the number of entries in the linked list
*/
- xhv = (XPVHV*)SvANY(PL_strtab);
+ register XPVHV * const xhv = (XPVHV*)SvANY(PL_strtab);
/* assert(xhv_array != 0) */
LOCK_STRTAB_MUTEX;
oentry = &(HvARRAY(PL_strtab))[hash & (I32) HvMAX(PL_strtab)];
int x = 0;
JMPENV_PUSH(x);
+ PERL_UNUSED_VAR(x);
if (PL_endav && !PL_minus_c)
call_list(PL_scopestack_ix, PL_endav);
JMPENV_POP;
if (!PL_rehash_seed_set)
PL_rehash_seed = get_hash_seed();
{
- char *s = PerlEnv_getenv("PERL_HASH_SEED_DEBUG");
+ const char *s = PerlEnv_getenv("PERL_HASH_SEED_DEBUG");
- if (s) {
- int i = atoi(s);
-
- if (i == 1)
- PerlIO_printf(Perl_debug_log, "HASH_SEED = %"UVuf"\n",
- PL_rehash_seed);
- }
+ if (s && (atoi(s) == 1))
+ PerlIO_printf(Perl_debug_log, "HASH_SEED = %"UVuf"\n", PL_rehash_seed);
}
#endif /* #if defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT) */
* --jhi */
const char *s = NULL;
int i;
- UV mask =
+ const UV mask =
~(UV)(PTRSIZE == 4 ? 3 : PTRSIZE == 8 ? 7 : PTRSIZE == 16 ? 15 : 0);
/* Do the mask check only if the args seem like aligned. */
- UV aligned =
+ const UV aligned =
(mask < ~(UV)0) && ((PTR2UV(argv[0]) & mask) == PTR2UV(argv[0]));
/* See if all the arguments are contiguous in memory. Note
f++;
}
}
+#else
+ PERL_UNUSED_ARG(proto);
+ PERL_UNUSED_ARG(param);
#endif
}
return newSVsv(arg);
}
#else
+ PERL_UNUSED_ARG(param);
return newSVsv(arg);
#endif
}
PerlIO *
PerlIOBase_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags)
{
- PerlIO *nexto = PerlIONext(o);
+ PerlIO * const nexto = PerlIONext(o);
if (PerlIOValid(nexto)) {
const PerlIO_funcs * const tab = PerlIOBase(nexto)->tab;
if (tab && tab->Dup)
}
PERL_ASYNC_CHECK();
}
+ /*NOTREACHED*/
}
Off_t
Note that C<sv_setref_pv> copies the pointer while this copies the string.
- SV* sv_setref_pvn(SV* rv, const char* classname, char* pv, STRLEN n)
+ SV* sv_setref_pvn(SV* rv, const char* classname, const char* pv, STRLEN n)
=for hackers
Found in file sv.c
if (SvMAGICAL(TARG)) {
U32 i;
for (i=0; i < (U32)maxarg; i++) {
- SV **svp = av_fetch((AV*)TARG, i, FALSE);
+ SV ** const svp = av_fetch((AV*)TARG, i, FALSE);
SP[i+1] = (svp) ? *svp : &PL_sv_undef;
}
}
SP += maxarg;
}
else if (gimme == G_SCALAR) {
- SV* sv = sv_newmortal();
+ SV* const sv = sv_newmortal();
const I32 maxarg = AvFILL((AV*)TARG) + 1;
sv_setiv(sv, maxarg);
PUSHs(sv);
RETURNOP(do_kv());
}
else if (gimme == G_SCALAR) {
- SV* sv = Perl_hv_scalar(aTHX_ (HV*)TARG);
+ SV* const sv = Perl_hv_scalar(aTHX_ (HV*)TARG);
SETs(sv);
}
RETURN;
sv = SvRV(sv);
if (SvTYPE(sv) == SVt_PVIO) {
- GV *gv = (GV*) sv_newmortal();
+ GV * const gv = (GV*) sv_newmortal();
gv_init(gv, 0, "", 0, 0);
GvIOp(gv) = (IO *)sv;
(void)SvREFCNT_inc(sv);
if ((PL_op->op_flags & OPf_SPECIAL) &&
!(PL_op->op_flags & OPf_MOD))
{
- SV * temp = (SV*)gv_fetchsv(sv, FALSE, SVt_PVGV);
+ SV * const temp = (SV*)gv_fetchsv(sv, FALSE, SVt_PVGV);
if (!temp
&& (!is_gv_magical_sv(sv,0)
|| !(sv = (SV*)gv_fetchsv(sv, TRUE, SVt_PVGV)))) {
PP(pp_av2arylen)
{
dSP;
- AV *av = (AV*)TOPs;
- SV **sv = Perl_av_arylen_p(aTHX_ (AV*)av);
+ AV * const av = (AV*)TOPs;
+ SV ** const sv = Perl_av_arylen_p(aTHX_ (AV*)av);
if (!*sv) {
*sv = NEWSV(0,0);
sv_upgrade(*sv, SVt_PVMG);
RETURN;
}
else {
- MAGIC* mg;
-
if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) {
- mg = mg_find(sv, PERL_MAGIC_regex_global);
+ const MAGIC * const mg = mg_find(sv, PERL_MAGIC_regex_global);
if (mg && mg->mg_len >= 0) {
I32 i = mg->mg_len;
if (DO_UTF8(sv))
PP(pp_ref)
{
dSP; dTARGET;
- SV *sv;
const char *pv;
-
- sv = POPs;
+ SV * const sv = POPs;
if (sv && SvGMAGICAL(sv))
mg_get(sv);
if (!sv || !SvROK(sv))
RETPUSHNO;
- sv = SvRV(sv);
- pv = sv_reftype(sv,TRUE);
+ pv = sv_reftype(SvRV(sv),TRUE);
PUSHp(pv, strlen(pv));
RETURN;
}
if (MAXARG == 1)
stash = CopSTASH(PL_curcop);
else {
- SV *ssv = POPs;
+ SV * const ssv = POPs;
STRLEN len;
const char *ptr;
PP(pp_gelem)
{
- GV *gv;
- SV *sv;
- SV *tmpRef;
- const char *elem;
dSP;
- sv = POPs;
- elem = SvPV_nolen_const(sv);
- gv = (GV*)POPs;
- tmpRef = Nullsv;
+ SV *sv = POPs;
+ const char * const elem = SvPV_nolen_const(sv);
+ GV * const gv = (GV*)POPs;
+ SV * tmpRef = Nullsv;
+
sv = Nullsv;
if (elem) {
/* elem will always be NUL terminated. */
- const char *elem2 = elem + 1;
+ const char * const second_letter = elem + 1;
switch (*elem) {
case 'A':
- if (strEQ(elem2, "RRAY"))
+ if (strEQ(second_letter, "RRAY"))
tmpRef = (SV*)GvAV(gv);
break;
case 'C':
- if (strEQ(elem2, "ODE"))
+ if (strEQ(second_letter, "ODE"))
tmpRef = (SV*)GvCVu(gv);
break;
case 'F':
- if (strEQ(elem2, "ILEHANDLE")) {
+ if (strEQ(second_letter, "ILEHANDLE")) {
/* finally deprecated in 5.8.0 */
deprecate("*glob{FILEHANDLE}");
tmpRef = (SV*)GvIOp(gv);
}
else
- if (strEQ(elem2, "ORMAT"))
+ if (strEQ(second_letter, "ORMAT"))
tmpRef = (SV*)GvFORM(gv);
break;
case 'G':
- if (strEQ(elem2, "LOB"))
+ if (strEQ(second_letter, "LOB"))
tmpRef = (SV*)gv;
break;
case 'H':
- if (strEQ(elem2, "ASH"))
+ if (strEQ(second_letter, "ASH"))
tmpRef = (SV*)GvHV(gv);
break;
case 'I':
- if (*elem2 == 'O' && !elem[2])
+ if (*second_letter == 'O' && !elem[2])
tmpRef = (SV*)GvIOp(gv);
break;
case 'N':
- if (strEQ(elem2, "AME"))
+ if (strEQ(second_letter, "AME"))
sv = newSVpvn(GvNAME(gv), GvNAMELEN(gv));
break;
case 'P':
- if (strEQ(elem2, "ACKAGE")) {
+ if (strEQ(second_letter, "ACKAGE")) {
const HEK *hek = HvNAME_HEK(GvSTASH(gv));
sv = hek ? newSVhek(hek) : newSVpvn("__ANON__", 8);
}
break;
case 'S':
- if (strEQ(elem2, "CALAR"))
+ if (strEQ(second_letter, "CALAR"))
tmpRef = GvSV(gv);
break;
}
sfirst -= 256;
while (--pos >= 0) {
- ch = s[pos];
+ register const I32 ch = s[pos];
if (sfirst[ch] >= 0)
snext[pos] = sfirst[ch] - pos;
else
PP(pp_defined)
{
dSP;
- register SV* sv;
+ register SV* const sv = POPs;
- sv = POPs;
if (!sv || !SvANY(sv))
RETPUSHNO;
switch (SvTYPE(sv)) {
if (baseuok) {
baseuv = SvUVX(TOPm1s);
} else {
- IV iv = SvIVX(TOPm1s);
+ const IV iv = SvIVX(TOPm1s);
if (iv >= 0) {
baseuv = iv;
baseuok = TRUE; /* effectively it's a UV now */
for (; power; base *= base, n++) {
/* Do I look like I trust gcc with long longs here?
Do I hell. */
- UV bit = (UV)1 << (UV)n;
+ const UV bit = (UV)1 << (UV)n;
if (power & bit) {
result *= base;
/* Only bother to clear the bit if it is set. */
register UV base = baseuv;
register int n = 0;
for (; power; base *= base, n++) {
- register UV bit = (UV)1 << (UV)n;
+ register const UV bit = (UV)1 << (UV)n;
if (power & bit) {
result *= base;
power -= bit;
if (auvok) {
alow = SvUVX(TOPm1s);
} else {
- IV aiv = SvIVX(TOPm1s);
+ const IV aiv = SvIVX(TOPm1s);
if (aiv >= 0) {
alow = aiv;
auvok = TRUE; /* effectively it's a UV now */
if (buvok) {
blow = SvUVX(TOPs);
} else {
- IV biv = SvIVX(TOPs);
+ const IV biv = SvIVX(TOPs);
if (biv >= 0) {
blow = biv;
buvok = TRUE; /* effectively it's a UV now */
right = SvUVX(TOPs);
}
else {
- IV biv = SvIVX(TOPs);
+ const IV biv = SvIVX(TOPs);
if (biv >= 0) {
right = biv;
right_non_neg = TRUE; /* effectively it's a UV now */
left = SvUVX(TOPm1s);
}
else {
- IV aiv = SvIVX(TOPm1s);
+ const IV aiv = SvIVX(TOPm1s);
if (aiv >= 0) {
left = aiv;
left_non_neg = TRUE; /* effectively it's a UV now */
#endif
) {
/* Integer division can't overflow, but it can be imprecise. */
- UV result = left / right;
+ const UV result = left / right;
if (result * right == left) {
SP--; /* result is valid */
if (left_non_neg == right_non_neg) {
if (!right_neg) {
right = SvUVX(POPs);
} else {
- IV biv = SvIVX(POPs);
+ const IV biv = SvIVX(POPs);
if (biv >= 0) {
right = biv;
right_neg = FALSE; /* effectively it's a UV now */
mg_get(sv);
if (SvIOKp(sv)) {
if (SvUOK(sv)) {
- UV uv = SvUV(sv);
+ const UV uv = SvUV(sv);
if (uv > IV_MAX)
count = IV_MAX; /* The best we can do? */
else
}
}
else if (SvNOKp(sv)) {
- NV nv = SvNV(sv);
+ const NV nv = SvNV(sv);
if (nv < 0.0)
count = 0;
else
if ((auvok = SvUOK(TOPm1s)))
auv = SvUVX(TOPm1s);
else {
- register IV aiv = SvIVX(TOPm1s);
+ register const IV aiv = SvIVX(TOPm1s);
if (aiv >= 0) {
auv = aiv;
auvok = 1; /* Now acting as a sign flag. */
if (buvok)
buv = SvUVX(TOPs);
else {
- register IV biv = SvIVX(TOPs);
+ register const IV biv = SvIVX(TOPs);
if (biv >= 0) {
buv = biv;
buvok = 1;
{
dSP; dATARGET; tryAMAGICbin(lshift,opASSIGN);
{
- IV shift = POPi;
+ const IV shift = POPi;
if (PL_op->op_private & HINT_INTEGER) {
IV i = TOPi;
SETi(i << shift);
{
dSP; dATARGET; tryAMAGICbin(rshift,opASSIGN);
{
- IV shift = POPi;
+ const IV shift = POPi;
if (PL_op->op_private & HINT_INTEGER) {
IV i = TOPi;
SETi(i >> shift);
bool buvok = SvUOK(TOPs);
if (!auvok && !buvok) { /* ## IV < IV ## */
- IV aiv = SvIVX(TOPm1s);
- IV biv = SvIVX(TOPs);
+ const IV aiv = SvIVX(TOPm1s);
+ const IV biv = SvIVX(TOPs);
SP--;
SETs(boolSV(aiv < biv));
RETURN;
}
if (auvok && buvok) { /* ## UV < UV ## */
- UV auv = SvUVX(TOPm1s);
- UV buv = SvUVX(TOPs);
+ const UV auv = SvUVX(TOPm1s);
+ const UV buv = SvUVX(TOPs);
SP--;
SETs(boolSV(auv < buv));
}
if (auvok) { /* ## UV < IV ## */
UV auv;
- IV biv;
-
- biv = SvIVX(TOPs);
+ const IV biv = SvIVX(TOPs);
SP--;
if (biv < 0) {
/* As (a) is a UV, it's >=0, so it cannot be < */
RETURN;
}
{ /* ## IV < UV ## */
- IV aiv;
+ const IV aiv = SvIVX(TOPm1s);
UV buv;
- aiv = SvIVX(TOPm1s);
if (aiv < 0) {
/* As (b) is a UV, it's >=0, so it must be < */
SP--;
bool buvok = SvUOK(TOPs);
if (!auvok && !buvok) { /* ## IV > IV ## */
- IV aiv = SvIVX(TOPm1s);
- IV biv = SvIVX(TOPs);
-
+ const IV aiv = SvIVX(TOPm1s);
+ const IV biv = SvIVX(TOPs);
+
SP--;
SETs(boolSV(aiv > biv));
RETURN;
}
if (auvok && buvok) { /* ## UV > UV ## */
- UV auv = SvUVX(TOPm1s);
- UV buv = SvUVX(TOPs);
+ const UV auv = SvUVX(TOPm1s);
+ const UV buv = SvUVX(TOPs);
SP--;
SETs(boolSV(auv > buv));
}
if (auvok) { /* ## UV > IV ## */
UV auv;
- IV biv;
-
- biv = SvIVX(TOPs);
+ const IV biv = SvIVX(TOPs);
+
SP--;
if (biv < 0) {
/* As (a) is a UV, it's >=0, so it must be > */
RETURN;
}
{ /* ## IV > UV ## */
- IV aiv;
+ const IV aiv = SvIVX(TOPm1s);
UV buv;
- aiv = SvIVX(TOPm1s);
if (aiv < 0) {
/* As (b) is a UV, it's >=0, so it cannot be > */
SP--;
bool buvok = SvUOK(TOPs);
if (!auvok && !buvok) { /* ## IV <= IV ## */
- IV aiv = SvIVX(TOPm1s);
- IV biv = SvIVX(TOPs);
+ const IV aiv = SvIVX(TOPm1s);
+ const IV biv = SvIVX(TOPs);
SP--;
SETs(boolSV(aiv <= biv));
}
if (auvok) { /* ## UV <= IV ## */
UV auv;
- IV biv;
-
- biv = SvIVX(TOPs);
+ const IV biv = SvIVX(TOPs);
+
SP--;
if (biv < 0) {
/* As (a) is a UV, it's >=0, so a cannot be <= */
RETURN;
}
{ /* ## IV <= UV ## */
- IV aiv;
+ const IV aiv = SvIVX(TOPm1s);
UV buv;
-
- aiv = SvIVX(TOPm1s);
+
if (aiv < 0) {
/* As (b) is a UV, it's >=0, so a must be <= */
SP--;
bool buvok = SvUOK(TOPs);
if (!auvok && !buvok) { /* ## IV >= IV ## */
- IV aiv = SvIVX(TOPm1s);
- IV biv = SvIVX(TOPs);
-
+ const IV aiv = SvIVX(TOPm1s);
+ const IV biv = SvIVX(TOPs);
+
SP--;
SETs(boolSV(aiv >= biv));
RETURN;
}
if (auvok && buvok) { /* ## UV >= UV ## */
- UV auv = SvUVX(TOPm1s);
- UV buv = SvUVX(TOPs);
-
+ const UV auv = SvUVX(TOPm1s);
+ const UV buv = SvUVX(TOPs);
+
SP--;
SETs(boolSV(auv >= buv));
RETURN;
}
if (auvok) { /* ## UV >= IV ## */
UV auv;
- IV biv;
-
- biv = SvIVX(TOPs);
+ const IV biv = SvIVX(TOPs);
+
SP--;
if (biv < 0) {
/* As (a) is a UV, it's >=0, so it must be >= */
RETURN;
}
{ /* ## IV >= UV ## */
- IV aiv;
+ const IV aiv = SvIVX(TOPm1s);
UV buv;
-
- aiv = SvIVX(TOPm1s);
+
if (aiv < 0) {
/* As (b) is a UV, it's >=0, so a cannot be >= */
SP--;
differ from normal zero. As I understand it. (Need to
check - is negative zero implementation defined behaviour
anyway?). NWC */
- UV buv = SvUVX(POPs);
- UV auv = SvUVX(TOPs);
-
+ const UV buv = SvUVX(POPs);
+ const UV auv = SvUVX(TOPs);
+
SETs(boolSV(auv != buv));
RETURN;
}
if (SvIOK(TOPs)) {
SvIV_please(TOPm1s);
if (SvIOK(TOPm1s)) {
- bool leftuvok = SvUOK(TOPm1s);
- bool rightuvok = SvUOK(TOPs);
+ const bool leftuvok = SvUOK(TOPm1s);
+ const bool rightuvok = SvUOK(TOPs);
I32 value;
if (!leftuvok && !rightuvok) { /* ## IV <=> IV ## */
- IV leftiv = SvIVX(TOPm1s);
- IV rightiv = SvIVX(TOPs);
+ const IV leftiv = SvIVX(TOPm1s);
+ const IV rightiv = SvIVX(TOPs);
if (leftiv > rightiv)
value = 1;
else
value = 0;
} else if (leftuvok && rightuvok) { /* ## UV <=> UV ## */
- UV leftuv = SvUVX(TOPm1s);
- UV rightuv = SvUVX(TOPs);
+ const UV leftuv = SvUVX(TOPm1s);
+ const UV rightuv = SvUVX(TOPs);
if (leftuv > rightuv)
value = 1;
else
value = 0;
} else if (leftuvok) { /* ## UV <=> IV ## */
- UV leftuv;
- IV rightiv;
-
- rightiv = SvIVX(TOPs);
+ const IV rightiv = SvIVX(TOPs);
if (rightiv < 0) {
/* As (a) is a UV, it's >=0, so it cannot be < */
value = 1;
} else {
- leftuv = SvUVX(TOPm1s);
+ const UV leftuv = SvUVX(TOPm1s);
if (leftuv > (UV)rightiv) {
value = 1;
} else if (leftuv < (UV)rightiv) {
}
}
} else { /* ## IV <=> UV ## */
- IV leftiv;
- UV rightuv;
-
- leftiv = SvIVX(TOPm1s);
+ const IV leftiv = SvIVX(TOPm1s);
if (leftiv < 0) {
/* As (b) is a UV, it's >=0, so it must be < */
value = -1;
} else {
- rightuv = SvUVX(TOPs);
+ const UV rightuv = SvUVX(TOPs);
if ((UV)leftiv > rightuv) {
value = 1;
} else if ((UV)leftiv < rightuv) {
dSP; tryAMAGICbinSET(slt,0);
{
dPOPTOPssrl;
- int cmp = (IN_LOCALE_RUNTIME
+ const int cmp = (IN_LOCALE_RUNTIME
? sv_cmp_locale(left, right)
: sv_cmp(left, right));
SETs(boolSV(cmp < 0));
dSP; tryAMAGICbinSET(sgt,0);
{
dPOPTOPssrl;
- int cmp = (IN_LOCALE_RUNTIME
+ const int cmp = (IN_LOCALE_RUNTIME
? sv_cmp_locale(left, right)
: sv_cmp(left, right));
SETs(boolSV(cmp > 0));
dSP; tryAMAGICbinSET(sle,0);
{
dPOPTOPssrl;
- int cmp = (IN_LOCALE_RUNTIME
+ const int cmp = (IN_LOCALE_RUNTIME
? sv_cmp_locale(left, right)
: sv_cmp(left, right));
SETs(boolSV(cmp <= 0));
dSP; tryAMAGICbinSET(sge,0);
{
dPOPTOPssrl;
- int cmp = (IN_LOCALE_RUNTIME
+ const int cmp = (IN_LOCALE_RUNTIME
? sv_cmp_locale(left, right)
: sv_cmp(left, right));
SETs(boolSV(cmp >= 0));
dSP; dTARGET; tryAMAGICbin(scmp,0);
{
dPOPTOPssrl;
- int cmp = (IN_LOCALE_RUNTIME
+ const int cmp = (IN_LOCALE_RUNTIME
? sv_cmp_locale(left, right)
: sv_cmp(left, right));
SETi( cmp );
if (SvGMAGICAL(right)) mg_get(right);
if (SvNIOKp(left) || SvNIOKp(right)) {
if (PL_op->op_private & HINT_INTEGER) {
- IV i = SvIV_nomg(left) & SvIV_nomg(right);
+ const IV i = SvIV_nomg(left) & SvIV_nomg(right);
SETi(i);
}
else {
- UV u = SvUV_nomg(left) & SvUV_nomg(right);
+ const UV u = SvUV_nomg(left) & SvUV_nomg(right);
SETu(u);
}
}
if (SvGMAGICAL(right)) mg_get(right);
if (SvNIOKp(left) || SvNIOKp(right)) {
if (PL_op->op_private & HINT_INTEGER) {
- IV i = (USE_LEFT(left) ? SvIV_nomg(left) : 0) ^ SvIV_nomg(right);
+ const IV i = (USE_LEFT(left) ? SvIV_nomg(left) : 0) ^ SvIV_nomg(right);
SETi(i);
}
else {
- UV u = (USE_LEFT(left) ? SvUV_nomg(left) : 0) ^ SvUV_nomg(right);
+ const UV u = (USE_LEFT(left) ? SvUV_nomg(left) : 0) ^ SvUV_nomg(right);
SETu(u);
}
}
if (SvGMAGICAL(right)) mg_get(right);
if (SvNIOKp(left) || SvNIOKp(right)) {
if (PL_op->op_private & HINT_INTEGER) {
- IV i = (USE_LEFT(left) ? SvIV_nomg(left) : 0) | SvIV_nomg(right);
+ const IV i = (USE_LEFT(left) ? SvIV_nomg(left) : 0) | SvIV_nomg(right);
SETi(i);
}
else {
- UV u = (USE_LEFT(left) ? SvUV_nomg(left) : 0) | SvUV_nomg(right);
+ const UV u = (USE_LEFT(left) ? SvUV_nomg(left) : 0) | SvUV_nomg(right);
SETu(u);
}
}
dSP; dTARGET; tryAMAGICun(neg);
{
dTOPss;
- int flags = SvFLAGS(sv);
+ const int flags = SvFLAGS(sv);
if (SvGMAGICAL(sv))
mg_get(sv);
if ((flags & SVf_IOK) || ((flags & (SVp_IOK | SVp_NOK)) == SVp_IOK)) {
mg_get(sv);
if (SvNIOKp(sv)) {
if (PL_op->op_private & HINT_INTEGER) {
- IV i = ~SvIV_nomg(sv);
+ const IV i = ~SvIV_nomg(sv);
SETi(i);
}
else {
- UV u = ~SvUV_nomg(sv);
+ const UV u = ~SvUV_nomg(sv);
SETu(u);
}
}
send = tmps + len;
while (tmps < send) {
- UV c = utf8n_to_uvchr(tmps, send-tmps, &l, UTF8_ALLOW_ANYUV);
+ const UV c = utf8n_to_uvchr(tmps, send-tmps, &l, UTF8_ALLOW_ANYUV);
tmps += UTF8SKIP(tmps);
targlen += UNISKIP(~c);
nchar++;
if (nwide) {
Newz(0, result, targlen + 1, U8);
while (tmps < send) {
- UV c = utf8n_to_uvchr(tmps, send-tmps, &l, UTF8_ALLOW_ANYUV);
+ const UV c = utf8n_to_uvchr(tmps, send-tmps, &l, UTF8_ALLOW_ANYUV);
tmps += UTF8SKIP(tmps);
result = uvchr_to_utf8_flags(result, ~c, UNICODE_ALLOW_ANY);
}
else {
Newz(0, result, nchar + 1, U8);
while (tmps < send) {
- U8 c = (U8)utf8n_to_uvchr(tmps, 0, &l, UTF8_ALLOW_ANY);
+ const U8 c = (U8)utf8n_to_uvchr(tmps, 0, &l, UTF8_ALLOW_ANY);
tmps += UTF8SKIP(tmps);
*result++ = ~c;
}
{
dSP; dTARGET; tryAMAGICun(sin);
{
- NV value;
- value = POPn;
- value = Perl_sin(value);
- XPUSHn(value);
+ const NV value = POPn;
+ XPUSHn(Perl_sin(value));
RETURN;
}
}
{
dSP; dTARGET; tryAMAGICun(cos);
{
- NV value;
- value = POPn;
- value = Perl_cos(value);
- XPUSHn(value);
+ const NV value = POPn;
+ XPUSHn(Perl_cos(value));
RETURN;
}
}
{
dSP; dTARGET; tryAMAGICun(log);
{
- NV value;
- value = POPn;
+ const NV value = POPn;
if (value <= 0.0) {
SET_NUMERIC_STANDARD();
DIE(aTHX_ "Can't take log of %"NVgf, value);
}
- value = Perl_log(value);
- XPUSHn(value);
+ XPUSHn(Perl_log(value));
RETURN;
}
}
{
dSP; dTARGET; tryAMAGICun(sqrt);
{
- NV value;
- value = POPn;
+ const NV value = POPn;
if (value < 0.0) {
SET_NUMERIC_STANDARD();
DIE(aTHX_ "Can't take sqrt of %"NVgf, value);
}
- value = Perl_sqrt(value);
- XPUSHn(value);
+ XPUSHn(Perl_sqrt(value));
RETURN;
}
}
{
dSP; dTARGET; tryAMAGICun(int);
{
- NV value;
- IV iv = TOPi; /* attempt to convert to IV if possible. */
+ const IV iv = TOPi; /* attempt to convert to IV if possible. */
/* XXX it's arguable that compiler casting to IV might be subtly
different from modf (for numbers inside (IV_MIN,UV_MAX)) in which
else preferring IV has introduced a subtle behaviour change bug. OTOH
SETu(0);
else if (SvIOK(TOPs)) {
if (SvIsUV(TOPs)) {
- UV uv = TOPu;
+ const UV uv = TOPu;
SETu(uv);
} else
SETi(iv);
} else {
- value = TOPn;
+ const NV value = TOPn;
if (value >= 0.0) {
if (value < (NV)UV_MAX + 0.5) {
SETu(U_V(value));
dSP; dTARGET; tryAMAGICun(abs);
{
/* This will cache the NV value if string isn't actually integer */
- IV iv = TOPi;
+ const IV iv = TOPi;
if (!SvOK(TOPs))
SETu(0);
}
}
} else{
- NV value = TOPn;
+ const NV value = TOPn;
if (value < 0.0)
- value = -value;
- SETn(value);
+ SETn(value);
+ else
+ SETn(-value);
}
}
RETURN;
STRLEN len;
NV result_nv;
UV result_uv;
- SV* sv = POPs;
+ SV* const sv = POPs;
tmps = (SvPV_const(sv, len));
if (DO_UTF8(sv)) {
/* If Unicode, try to downgrade
* If not possible, croak. */
- SV* tsv = sv_2mortal(newSVsv(sv));
+ SV* const tsv = sv_2mortal(newSVsv(sv));
SvUTF8_on(tsv);
sv_utf8_downgrade(tsv, FALSE);
STRLEN len;
NV result_nv;
UV result_uv;
- SV* sv = POPs;
+ SV* const sv = POPs;
tmps = (SvPV_const(sv, len));
if (DO_UTF8(sv)) {
/* If Unicode, try to downgrade
* If not possible, croak. */
- SV* tsv = sv_2mortal(newSVsv(sv));
+ SV* const tsv = sv_2mortal(newSVsv(sv));
SvUTF8_on(tsv);
sv_utf8_downgrade(tsv, FALSE);
SV *repl_sv = NULL;
const char *repl = 0;
STRLEN repl_len;
- int num_args = PL_op->op_private & 7;
+ const int num_args = PL_op->op_private & 7;
bool repl_need_utf8_upgrade = FALSE;
bool repl_is_utf8 = FALSE;
RETPUSHUNDEF;
}
else {
- I32 upos = pos;
- I32 urem = rem;
+ const I32 upos = pos;
+ const I32 urem = rem;
if (utf8_curlen)
sv_pos_u2b(sv, &pos, &rem);
tmps += pos;
PP(pp_vec)
{
dSP; dTARGET;
- register IV size = POPi;
- register IV offset = POPi;
- register SV *src = POPs;
- I32 lvalue = PL_op->op_flags & OPf_MOD || LVRET;
+ register const IV size = POPi;
+ register const IV offset = POPi;
+ register SV * const src = POPs;
+ const I32 lvalue = PL_op->op_flags & OPf_MOD || LVRET;
SvTAINTED_off(TARG); /* decontaminate */
if (lvalue) { /* it's an lvalue! */
const char *tmps;
const char *tmps2;
STRLEN biglen;
- I32 arybase = PL_curcop->cop_arybase;
+ const I32 arybase = PL_curcop->cop_arybase;
int big_utf8;
int little_utf8;
little_utf8 = DO_UTF8(little);
if (big_utf8 ^ little_utf8) {
/* One needs to be upgraded. */
- SV *bytes = little_utf8 ? big : little;
+ SV * const bytes = little_utf8 ? big : little;
STRLEN len;
- const char *p = SvPV_const(bytes, len);
+ const char * const p = SvPV_const(bytes, len);
temp = newSVpvn(p, len);
I32 retval;
const char *tmps;
const char *tmps2;
- I32 arybase = PL_curcop->cop_arybase;
+ const I32 arybase = PL_curcop->cop_arybase;
int big_utf8;
int little_utf8;
little_utf8 = DO_UTF8(little);
if (big_utf8 ^ little_utf8) {
/* One needs to be upgraded. */
- SV *bytes = little_utf8 ? big : little;
+ SV * const bytes = little_utf8 ? big : little;
STRLEN len;
const char *p = SvPV_const(bytes, len);
/* If Unicode, try to downgrade.
* If not possible, croak.
* Yes, we made this up. */
- SV* tsv = sv_2mortal(newSVsv(left));
+ SV* const tsv = sv_2mortal(newSVsv(left));
SvUTF8_on(tsv);
sv_utf8_downgrade(tsv, FALSE);
d = (U8*)SvPVX(TARG);
send = s + len;
while (s < send) {
- STRLEN u = UTF8SKIP(s);
- UV uv = toLOWER_utf8(s, tmpbuf, &ulen);
+ const STRLEN u = UTF8SKIP(s);
+ const UV uv = toLOWER_utf8(s, tmpbuf, &ulen);
#define GREEK_CAPITAL_LETTER_SIGMA 0x03A3 /* Unicode U+03A3 */
if (uv == GREEK_CAPITAL_LETTER_SIGMA) {
s = (U8*)SvPV_force_nomg(sv, len);
if (len) {
- register U8 *send = s + len;
+ register const U8 * const send = s + len;
if (IN_LOCALE_RUNTIME) {
TAINT;
PP(pp_quotemeta)
{
dSP; dTARGET;
- SV *sv = TOPs;
+ SV * const sv = TOPs;
STRLEN len;
const register char *s = SvPV_const(sv,len);
- register char *d;
SvUTF8_off(TARG); /* decontaminate */
if (len) {
+ register char *d;
SvUPGRADE(TARG, SVt_PV);
SvGROW(TARG, (len * 2) + 1);
d = SvPVX(TARG);
PP(pp_aslice)
{
dSP; dMARK; dORIGMARK;
- register SV** svp;
- register AV* av = (AV*)POPs;
- register I32 lval = (PL_op->op_flags & OPf_MOD || LVRET);
- I32 arybase = PL_curcop->cop_arybase;
- I32 elem;
+ register AV* const av = (AV*)POPs;
+ register const I32 lval = (PL_op->op_flags & OPf_MOD || LVRET);
if (SvTYPE(av) == SVt_PVAV) {
+ const I32 arybase = PL_curcop->cop_arybase;
if (lval && PL_op->op_private & OPpLVAL_INTRO) {
+ register SV **svp;
I32 max = -1;
for (svp = MARK + 1; svp <= SP; svp++) {
- elem = SvIVx(*svp);
+ const I32 elem = SvIVx(*svp);
if (elem > max)
max = elem;
}
av_extend(av, max);
}
while (++MARK <= SP) {
- elem = SvIVx(*MARK);
+ register SV **svp;
+ I32 elem = SvIVx(*MARK);
if (elem > 0)
elem -= arybase;
PP(pp_each)
{
dSP;
- HV *hash = (HV*)POPs;
+ HV * const hash = (HV*)POPs;
HE *entry;
const I32 gimme = GIMME_V;
EXTEND(SP, 2);
if (entry) {
- SV* sv = hv_iterkeysv(entry);
+ SV* const sv = hv_iterkeysv(entry);
PUSHs(sv); /* won't clobber stack_sp */
if (gimme == G_ARRAY) {
SV *val;
dSP;
const I32 gimme = GIMME_V;
const I32 discard = (gimme == G_VOID) ? G_DISCARD : 0;
- SV *sv;
- HV *hv;
if (PL_op->op_private & OPpSLICE) {
dMARK; dORIGMARK;
- U32 hvtype;
- hv = (HV*)POPs;
- hvtype = SvTYPE(hv);
+ HV * const hv = (HV*)POPs;
+ const U32 hvtype = SvTYPE(hv);
if (hvtype == SVt_PVHV) { /* hash element */
while (++MARK <= SP) {
- sv = hv_delete_ent(hv, *MARK, discard, 0);
+ SV * const sv = hv_delete_ent(hv, *MARK, discard, 0);
*MARK = sv ? sv : &PL_sv_undef;
}
}
else if (hvtype == SVt_PVAV) { /* array element */
if (PL_op->op_flags & OPf_SPECIAL) {
while (++MARK <= SP) {
- sv = av_delete((AV*)hv, SvIV(*MARK), discard);
+ SV * const sv = av_delete((AV*)hv, SvIV(*MARK), discard);
*MARK = sv ? sv : &PL_sv_undef;
}
}
}
else {
SV *keysv = POPs;
- hv = (HV*)POPs;
+ HV * const hv = (HV*)POPs;
+ SV *sv;
if (SvTYPE(hv) == SVt_PVHV)
sv = hv_delete_ent(hv, keysv, discard, 0);
else if (SvTYPE(hv) == SVt_PVAV) {
if (PL_op->op_private & OPpEXISTS_SUB) {
GV *gv;
- CV *cv;
SV *sv = POPs;
- cv = sv_2cv(sv, &hv, &gv, FALSE);
+ CV * const cv = sv_2cv(sv, &hv, &gv, FALSE);
if (cv)
RETPUSHYES;
if (gv && isGV(gv) && GvCV(gv) && !GvCVGEN(gv))
PP(pp_hslice)
{
dSP; dMARK; dORIGMARK;
- register HV *hv = (HV*)POPs;
- register I32 lval = (PL_op->op_flags & OPf_MOD || LVRET);
- bool localizing = PL_op->op_private & OPpLVAL_INTRO ? TRUE : FALSE;
+ register HV * const hv = (HV*)POPs;
+ register const I32 lval = (PL_op->op_flags & OPf_MOD || LVRET);
+ const bool localizing = PL_op->op_private & OPpLVAL_INTRO;
bool other_magic = FALSE;
if (localizing) {
}
while (++MARK <= SP) {
- SV *keysv = *MARK;
+ SV * const keysv = *MARK;
SV **svp;
HE *he;
bool preeminent = FALSE;
PP(pp_lslice)
{
dSP;
- SV **lastrelem = PL_stack_sp;
- SV **lastlelem = PL_stack_base + POPMARK;
- SV **firstlelem = PL_stack_base + POPMARK + 1;
- register SV **firstrelem = lastlelem + 1;
- I32 arybase = PL_curcop->cop_arybase;
- I32 lval = PL_op->op_flags & OPf_MOD;
- I32 is_something_there = lval;
-
- register I32 max = lastrelem - lastlelem;
+ SV ** const lastrelem = PL_stack_sp;
+ SV ** const lastlelem = PL_stack_base + POPMARK;
+ SV ** const firstlelem = PL_stack_base + POPMARK + 1;
+ register SV ** const firstrelem = lastlelem + 1;
+ const I32 arybase = PL_curcop->cop_arybase;
+ I32 is_something_there = PL_op->op_flags & OPf_MOD;
+
+ register const I32 max = lastrelem - lastlelem;
register SV **lelem;
- register I32 ix;
if (GIMME != G_ARRAY) {
- ix = SvIVx(*lastlelem);
+ I32 ix = SvIVx(*lastlelem);
if (ix < 0)
ix += max;
else
}
for (lelem = firstlelem; lelem <= lastlelem; lelem++) {
- ix = SvIVx(*lelem);
+ I32 ix = SvIVx(*lelem);
if (ix < 0)
ix += max;
else
PP(pp_anonlist)
{
dSP; dMARK; dORIGMARK;
- I32 items = SP - MARK;
- SV *av = sv_2mortal((SV*)av_make(items, MARK+1));
+ const I32 items = SP - MARK;
+ SV * const av = sv_2mortal((SV*)av_make(items, MARK+1));
SP = ORIGMARK; /* av_make() might realloc stack_sp */
XPUSHs(av);
RETURN;
PP(pp_anonhash)
{
dSP; dMARK; dORIGMARK;
- HV* hv = (HV*)sv_2mortal((SV*)newHV());
+ HV* const hv = (HV*)sv_2mortal((SV*)newHV());
while (MARK < SP) {
- SV* key = *++MARK;
- SV *val = NEWSV(46, 0);
+ SV * const key = *++MARK;
+ SV * const val = NEWSV(46, 0);
if (MARK < SP)
sv_setsv(val, *++MARK);
else if (ckWARN(WARN_MISC))
I32 after;
I32 diff;
SV **tmparyval = 0;
- MAGIC *mg;
+ const MAGIC * const mg = SvTIED_mg((SV*)ary, PERL_MAGIC_tied);
- if ((mg = SvTIED_mg((SV*)ary, PERL_MAGIC_tied))) {
+ if (mg) {
*MARK-- = SvTIED_obj((SV*)ary, mg);
PUSHMARK(MARK);
PUTBACK;
/* make new elements SVs now: avoid problems if they're from the array */
for (dst = MARK, i = newlen; i; i--) {
- SV *h = *dst;
+ SV * const h = *dst;
*dst++ = newSVsv(h);
}
{
dVAR; dSP; dMARK; dORIGMARK; dTARGET;
register AV *ary = (AV*)*++MARK;
- register SV *sv = &PL_sv_undef;
- MAGIC *mg;
+ const MAGIC * const mg = SvTIED_mg((SV*)ary, PERL_MAGIC_tied);
- if ((mg = SvTIED_mg((SV*)ary, PERL_MAGIC_tied))) {
+ if (mg) {
*MARK-- = SvTIED_obj((SV*)ary, mg);
PUSHMARK(MARK);
PUTBACK;
else {
/* Why no pre-extend of ary here ? */
for (++MARK; MARK <= SP; MARK++) {
- sv = NEWSV(51, 0);
+ SV * const sv = NEWSV(51, 0);
if (*MARK)
sv_setsv(sv, *MARK);
av_push(ary, sv);
PP(pp_pop)
{
dSP;
- AV *av = (AV*)POPs;
- SV *sv = av_pop(av);
+ AV * const av = (AV*)POPs;
+ SV * const sv = av_pop(av);
if (AvREAL(av))
(void)sv_2mortal(sv);
PUSHs(sv);
PP(pp_shift)
{
dSP;
- AV *av = (AV*)POPs;
- SV *sv = av_shift(av);
+ AV * const av = (AV*)POPs;
+ SV * const sv = av_shift(av);
EXTEND(SP, 1);
if (!sv)
RETPUSHUNDEF;
{
dVAR; dSP; dMARK; dORIGMARK; dTARGET;
register AV *ary = (AV*)*++MARK;
- register SV *sv;
- register I32 i = 0;
- MAGIC *mg;
+ const MAGIC * const mg = SvTIED_mg((SV*)ary, PERL_MAGIC_tied);
- if ((mg = SvTIED_mg((SV*)ary, PERL_MAGIC_tied))) {
+ if (mg) {
*MARK-- = SvTIED_obj((SV*)ary, mg);
PUSHMARK(MARK);
PUTBACK;
SPAGAIN;
}
else {
+ register I32 i = 0;
av_unshift(ary, SP - MARK);
while (MARK < SP) {
- sv = newSVsv(*++MARK);
+ SV * const sv = newSVsv(*++MARK);
(void)av_store(ary, i++, sv);
}
}
PP(pp_reverse)
{
dSP; dMARK;
- register SV *tmp;
- SV **oldsp = SP;
+ SV ** const oldsp = SP;
if (GIMME == G_ARRAY) {
MARK++;
while (MARK < SP) {
- tmp = *MARK;
+ register SV * const tmp = *MARK;
*MARK++ = *SP;
*SP-- = tmp;
}
dVAR; dSP; dTARG;
AV *ary;
register IV limit = POPi; /* note, negative is forever */
- SV *sv = POPs;
+ SV * const sv = POPs;
STRLEN len;
register const char *s = SvPV_const(sv, len);
- bool do_utf8 = DO_UTF8(sv);
+ const bool do_utf8 = DO_UTF8(sv);
const char *strend = s + len;
register PMOP *pm;
register REGEXP *rx;
I32 iters = 0;
const STRLEN slen = do_utf8 ? utf8_length((U8*)s, (U8*)strend) : (strend - s);
I32 maxiters = slen + 10;
- I32 i;
const char *orig;
- I32 origlimit = limit;
+ const I32 origlimit = limit;
I32 realarray = 0;
I32 base;
const I32 gimme = GIMME_V;
}
else {
if (!AvREAL(ary)) {
+ I32 i;
AvREAL_on(ary);
AvREIFY_off(ary);
for (i = AvFILLp(ary); i >= 0; i--)
(rx->reganch & RE_USE_INTUIT) && !rx->nparens
&& (rx->reganch & ROPT_CHECK_ALL)
&& !(rx->reganch & ROPT_ANCH)) {
- int tail = (rx->reganch & RE_INTUIT_TAIL);
- SV *csv = CALLREG_INTUIT_STRING(aTHX_ rx);
+ const int tail = (rx->reganch & RE_INTUIT_TAIL);
+ SV * const csv = CALLREG_INTUIT_STRING(aTHX_ rx);
len = rx->minlen;
if (len == 1 && !(rx->reganch & ROPT_UTF8) && !tail) {
- char c = *SvPV_nolen_const(csv);
+ const char c = *SvPV_nolen_const(csv);
while (--limit) {
for (m = s; m < strend && *m != c; m++)
;
maxiters += slen * rx->nparens;
while (s < strend && --limit)
{
+ I32 rex_return;
PUTBACK;
- i = CALLREGEXEC(aTHX_ rx, (char*)s, (char*)strend, (char*)orig, 1 ,
+ rex_return = CALLREGEXEC(aTHX_ rx, (char*)s, (char*)strend, (char*)orig, 1 ,
sv, NULL, 0);
SPAGAIN;
- if (i == 0)
+ if (rex_return == 0)
break;
TAINT_IF(RX_MATCH_TAINTED(rx));
if (RX_MATCH_COPIED(rx) && rx->subbeg != orig) {
(void)SvUTF8_on(dstr);
XPUSHs(dstr);
if (rx->nparens) {
+ I32 i;
for (i = 1; i <= (I32)rx->nparens; i++) {
s = rx->startp[i] + orig;
m = rx->endp[i] + orig;
/* keep field after final delim? */
if (s < strend || (iters && origlimit)) {
- STRLEN l = strend - s;
+ const STRLEN l = strend - s;
dstr = newSVpvn(s, l);
if (make_mortal)
sv_2mortal(dstr);
LEAVE;
SPAGAIN;
if (gimme == G_ARRAY) {
+ I32 i;
/* EXTEND should not be needed - we just popped them */
EXTEND(SP, iters);
for (i=0; i < iters; i++) {
} } STMT_END
/* Same thing, but update mark register too. */
-#define MEXTEND(p,n) STMT_START {if (PL_stack_max - p < (int)(n)) { \
- int markoff = mark - PL_stack_base; \
+#define MEXTEND(p,n) STMT_START {if (PL_stack_max - p < (int)(n)) { \
+ const int markoff = mark - PL_stack_base; \
sp = stack_grow(sp,p,(int) (n)); \
mark = PL_stack_base + markoff; \
} } STMT_END
#define tryAMAGICbinW(meth,assign,set) STMT_START { \
if (PL_amagic_generation) { \
SV* tmpsv; \
- SV* right= *(sp); SV* left= *(sp-1);\
+ SV* const right= *(sp); SV* const left= *(sp-1);\
if ((SvAMAGIC(left)||SvAMAGIC(right))&&\
(tmpsv=amagic_call(left, \
right, \
=cut */
#define LVRET ((PL_op->op_private & OPpMAYBE_LVSUB) && is_lvalue_sub())
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * ex: set ts=8 sts=4 sw=4 noet:
+ */
}
cxstack_ix--;
}
+ PERL_UNUSED_VAR(optype);
}
void
dounwind(cxix);
POPBLOCK(cx,newpm);
+ PERL_UNUSED_VAR(optype);
cxstack_ix++; /* temporarily protect top context */
mark = newsp;
switch (CxTYPE(cx)) {
PUSHMARK(mark);
PUTBACK;
(void)(*CvXSUB(cv))(aTHX_ cv);
+ /* Put these at the bottom since the vars are set but not used */
+ PERL_UNUSED_VAR(newsp);
+ PERL_UNUSED_VAR(gimme);
}
LEAVE;
return retop;
for (ix = si->si_cxix; ix >= 0; ix--) {
const PERL_CONTEXT *cx = &(si->si_cxstack[ix]);
if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT) {
- CV *cv = cx->blk_sub.cv;
+ CV * const cv = cx->blk_sub.cv;
/* skip DB:: code */
if (db_seqp && PL_debstash && CvSTASH(cv) == PL_debstash) {
*db_seqp = cx->blk_oldcop->cop_seq;
{
dSP; dTARGET;
PerlIO *fp;
- const char *tmps = POPpconstx;
+ const char * const tmps = POPpconstx;
const I32 gimme = GIMME_V;
const char *mode = "r";
SvTAINTED_on(TARG);
}
else {
- SV *sv;
-
for (;;) {
- sv = NEWSV(56, 79);
+ SV * const sv = NEWSV(56, 79);
if (sv_gets(sv, fp, 0) == Nullch) {
SvREFCNT_dec(sv);
break;
}
tmps = SvPV_const(tmpsv, len);
if ((!tmps || !len) && PL_errgv) {
- SV *error = ERRSV;
+ SV * const error = ERRSV;
SvUPGRADE(error, SVt_PV);
if (SvPOK(error) && SvCUR(error))
sv_catpv(error, "\t...caught");
RETPUSHYES;
if ((mg = SvTIED_mg(sv, how))) {
- SV *obj = SvRV(SvTIED_obj(sv, mg));
+ SV * const obj = SvRV(SvTIED_obj(sv, mg));
GV *gv;
CV *cv = NULL;
if (obj) {
PP(pp_tied)
{
dSP;
- MAGIC *mg;
+ const MAGIC *mg;
SV *sv = POPs;
const char how = (SvTYPE(sv) == SVt_PVHV || SvTYPE(sv) == SVt_PVAV)
? PERL_MAGIC_tied : PERL_MAGIC_tiedscalar;
PP(pp_dbmopen)
{
dVAR; dSP;
- HV *hv;
dPOPPOPssrl;
HV* stash;
GV *gv;
SV *sv;
- hv = (HV*)POPs;
+ HV * const hv = (HV*)POPs;
sv = sv_mortalcopy(&PL_sv_no);
sv_setpv(sv, "AnyDBM_File");
if (! hv)
XPUSHs(&PL_sv_undef);
else {
- GV **gvp = (GV**)hv_fetch(hv, GvNAME(egv), GvNAMELEN(egv), FALSE);
+ GV ** const gvp = (GV**)hv_fetch(hv, GvNAME(egv), GvNAMELEN(egv), FALSE);
if (gvp && *gvp == egv) {
gv_efullname4(TARG, PL_defoutgv, Nullch, TRUE);
XPUSHTARG;
PP(pp_getc)
{
dVAR; dSP; dTARGET;
- GV *gv;
IO *io = NULL;
MAGIC *mg;
-
- if (MAXARG == 0)
- gv = PL_stdingv;
- else
- gv = (GV*)POPs;
+ GV * const gv = (MAXARG==0) ? PL_stdingv : (GV*)POPs;
if (gv && (io = GvIO(gv))
&& (mg = SvTIED_mg((SV*)io, PERL_MAGIC_tiedscalar)))
PP(pp_leavewrite)
{
dVAR; dSP;
- GV *gv = cxstack[cxstack_ix].blk_sub.gv;
- register IO *io = GvIOp(gv);
- PerlIO *ofp = IoOFP(io);
+ GV * const gv = cxstack[cxstack_ix].blk_sub.gv;
+ register IO * const io = GvIOp(gv);
+ PerlIO * const ofp = IoOFP(io);
PerlIO *fp;
SV **newsp;
I32 gimme;
register PERL_CONTEXT *cx;
+ PERL_UNUSED_VAR(newsp);
+ PERL_UNUSED_VAR(gimme);
DEBUG_f(PerlIO_printf(Perl_debug_log, "left=%ld, todo=%ld\n",
(long)IoLINES_LEFT(io), (long)FmLINES(PL_formtarget)));
CV *cv;
if (!IoTOP_GV(io)) {
GV *topgv;
- SV *topname;
if (!IoTOP_NAME(io)) {
+ SV *topname;
if (!IoFMT_NAME(io))
IoFMT_NAME(io) = savepv(GvNAME(gv));
topname = sv_2mortal(Perl_newSVpvf(aTHX_ "%s_TOP", GvNAME(gv)));
PP(pp_sysopen)
{
dSP;
- GV *gv;
- SV *sv;
- const char *tmps;
- STRLEN len;
const int perm = (MAXARG > 3) ? POPi : 0666;
const int mode = POPi;
-
- sv = POPs;
- gv = (GV *)POPs;
+ SV * const sv = POPs;
+ GV * const gv = (GV *)POPs;
+ STRLEN len;
/* Need TIEHANDLE method ? */
-
- tmps = SvPV_const(sv, len);
+ const char * const tmps = SvPV_const(sv, len);
/* FIXME? do_open should do const */
if (do_open(gv, (char*)tmps, len, TRUE, mode, perm, Nullfp)) {
IoLINES(GvIOp(gv)) = 0;
{
dVAR; dSP; dMARK; dORIGMARK; dTARGET;
int offset;
- GV *gv;
IO *io;
char *buffer;
SSize_t length;
Sock_size_t bufsize;
SV *bufsv;
STRLEN blen;
- MAGIC *mg;
int fp_utf8;
int buffer_utf8;
SV *read_target;
STRLEN charskip = 0;
STRLEN skip = 0;
- gv = (GV*)*++MARK;
+ GV * const gv = (GV*)*++MARK;
if ((PL_op->op_type == OP_READ || PL_op->op_type == OP_SYSREAD)
- && gv && (io = GvIO(gv))
- && (mg = SvTIED_mg((SV*)io, PERL_MAGIC_tiedscalar)))
+ && gv && (io = GvIO(gv)) )
{
- SV *sv;
-
- PUSHMARK(MARK-1);
- *MARK = SvTIED_obj((SV*)io, mg);
- ENTER;
- call_method("READ", G_SCALAR);
- LEAVE;
- SPAGAIN;
- sv = POPs;
- SP = ORIGMARK;
- PUSHs(sv);
- RETURN;
+ const MAGIC * mg = SvTIED_mg((SV*)io, PERL_MAGIC_tiedscalar);
+ if (mg) {
+ SV *sv;
+ PUSHMARK(MARK-1);
+ *MARK = SvTIED_obj((SV*)io, mg);
+ ENTER;
+ call_method("READ", G_SCALAR);
+ LEAVE;
+ SPAGAIN;
+ sv = POPs;
+ SP = ORIGMARK;
+ PUSHs(sv);
+ RETURN;
+ }
}
if (!gv)
PERL_CALLCONV I32 Perl_apply(pTHX_ I32 type, SV** mark, SV** sp);
PERL_CALLCONV void Perl_apply_attrs_string(pTHX_ const char *stashpv, CV *cv, const char *attrstr, STRLEN len);
PERL_CALLCONV void Perl_av_clear(pTHX_ AV* ar);
-PERL_CALLCONV SV* Perl_av_delete(pTHX_ AV* ar, I32 key, I32 flags)
- __attribute__warn_unused_result__;
-
+PERL_CALLCONV SV* Perl_av_delete(pTHX_ AV* ar, I32 key, I32 flags);
PERL_CALLCONV bool Perl_av_exists(pTHX_ AV* ar, I32 key)
__attribute__warn_unused_result__;
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_2);
-PERL_CALLCONV SV* Perl_av_pop(pTHX_ AV* ar)
- __attribute__warn_unused_result__;
-
+PERL_CALLCONV SV* Perl_av_pop(pTHX_ AV* ar);
PERL_CALLCONV void Perl_av_push(pTHX_ AV* ar, SV* val);
PERL_CALLCONV void Perl_av_reify(pTHX_ AV* ar);
PERL_CALLCONV SV* Perl_av_shift(pTHX_ AV* ar)
PERL_CALLCONV void Perl_gv_fullname4(pTHX_ SV* sv, const GV* gv, const char* prefix, bool keepmain);
PERL_CALLCONV void Perl_gv_init(pTHX_ GV* gv, HV* stash, const char* name, STRLEN len, int multi)
__attribute__nonnull__(pTHX_1)
- __attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3);
PERL_CALLCONV HV* Perl_gv_stashpv(pTHX_ const char* name, I32 create);
PERL_CALLCONV SV* Perl_vnewSVpvf(pTHX_ const char* pat, va_list* args);
PERL_CALLCONV SV* Perl_newSVrv(pTHX_ SV* rv, const char* classname)
__attribute__malloc__
- __attribute__warn_unused_result__;
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
PERL_CALLCONV SV* Perl_newSVsv(pTHX_ SV* old)
__attribute__malloc__
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV SV* Perl_sv_mortalcopy(pTHX_ SV* oldsv)
- __attribute__nonnull__(pTHX_1);
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
PERL_CALLCONV SV* Perl_sv_newmortal(pTHX)
__attribute__warn_unused_result__;
PERL_CALLCONV SV* Perl_sv_setref_uv(pTHX_ SV* rv, const char* classname, UV uv);
PERL_CALLCONV SV* Perl_sv_setref_nv(pTHX_ SV* rv, const char* classname, NV nv);
PERL_CALLCONV SV* Perl_sv_setref_pv(pTHX_ SV* rv, const char* classname, void* pv);
-PERL_CALLCONV SV* Perl_sv_setref_pvn(pTHX_ SV* rv, const char* classname, char* pv, STRLEN n);
+PERL_CALLCONV SV* Perl_sv_setref_pvn(pTHX_ SV* rv, const char* classname, const char* pv, STRLEN n)
+ __attribute__nonnull__(pTHX_3);
+
PERL_CALLCONV void Perl_sv_setpv(pTHX_ SV* sv, const char* ptr);
PERL_CALLCONV void Perl_sv_setpvn(pTHX_ SV* sv, const char* ptr, STRLEN len)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV MGVTBL* Perl_get_vtbl(pTHX_ int vtbl_id);
PERL_CALLCONV char* Perl_pv_display(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim);
PERL_CALLCONV void Perl_dump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...)
- __attribute__format__(__printf__,pTHX_3,pTHX_4);
-
-PERL_CALLCONV void Perl_dump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args);
-PERL_CALLCONV void Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv);
-PERL_CALLCONV void Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv);
-PERL_CALLCONV void Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, const char *name, HV *sv);
-PERL_CALLCONV void Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, const MAGIC *mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim);
-PERL_CALLCONV void Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o);
-PERL_CALLCONV void Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, const PMOP *pm);
-PERL_CALLCONV void Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim);
+ __attribute__format__(__printf__,pTHX_3,pTHX_4)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_dump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, const char *name, HV *sv)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, const MAGIC *mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, const PMOP *pm)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
+ __attribute__nonnull__(pTHX_2);
+
PERL_CALLCONV void Perl_magic_dump(pTHX_ const MAGIC *mg);
PERL_CALLCONV void Perl_reginitcolors(pTHX);
PERL_CALLCONV char* Perl_sv_2pv_nolen(pTHX_ SV* sv);
STATIC void S_unshare_hek_or_pvn(pTHX_ const HEK* hek, const char* str, I32 len, U32 hash);
STATIC HEK* S_share_hek_flags(pTHX_ const char* sv, I32 len, U32 hash, int flags)
- __attribute__warn_unused_result__;
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
STATIC void S_hv_notallowed(pTHX_ int flags, const char *key, I32 klen, const char *msg)
__attribute__noreturn__
#endif
#if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT)
-STATIC IV S_asIV(pTHX_ SV* sv);
-STATIC UV S_asUV(pTHX_ SV* sv);
-STATIC void S_sv_unglob(pTHX_ SV* sv);
-STATIC void S_not_a_number(pTHX_ SV *sv);
-STATIC I32 S_visit(pTHX_ SVFUNC_t f, U32 flags, U32 mask);
-STATIC void S_sv_add_backref(pTHX_ SV *tsv, SV *sv);
-STATIC void S_sv_del_backref(pTHX_ SV *sv);
+STATIC IV S_asIV(pTHX_ SV* sv)
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+
+STATIC UV S_asUV(pTHX_ SV* sv)
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+
+STATIC void S_sv_unglob(pTHX_ SV* sv)
+ __attribute__nonnull__(pTHX_1);
+
+STATIC void S_not_a_number(pTHX_ SV *sv)
+ __attribute__nonnull__(pTHX_1);
+
+STATIC I32 S_visit(pTHX_ SVFUNC_t f, U32 flags, U32 mask)
+ __attribute__nonnull__(pTHX_1);
+
+STATIC void S_sv_add_backref(pTHX_ SV *tsv, SV *sv)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
+
+STATIC void S_sv_del_backref(pTHX_ SV *sv)
+ __attribute__nonnull__(pTHX_1);
+
STATIC SV * S_varname(pTHX_ GV *gv, const char *gvtype, PADOFFSET targ, SV *keyname, I32 aindex, int subscript_type)
+ __attribute__warn_unused_result__
__attribute__nonnull__(pTHX_2);
# ifdef DEBUGGING
static void
S_free_arena(pTHX_ void **root) {
while (root) {
- void **next = *(void **)root;
+ void ** const next = *(void **)root;
Safefree(root);
root = next;
}
AV *av;
if (!cv || !CvPADLIST(cv))
- return Nullsv;;
+ return Nullsv;
av = (AV*)(*av_fetch(CvPADLIST(cv), 0, FALSE));
sv = *av_fetch(av, targ, FALSE);
/* SvLEN in a pad name is not to be trusted */
}
if (subscript_type == FUV_SUBSCRIPT_HASH) {
- SV *sv;
+ SV * const sv = NEWSV(0,0);
*SvPVX(name) = '$';
- sv = NEWSV(0,0);
Perl_sv_catpvf(aTHX_ name, "{%s}",
pv_display(sv,SvPVX_const(keyname), SvCUR(keyname), 0, 32));
SvREFCNT_dec(sv);
dVAR;
SV *sv;
AV *av;
- SV **svp;
GV *gv;
OP *o, *o2, *kid;
if (match && subscript_type == FUV_SUBSCRIPT_WITHIN)
break;
- return S_varname(aTHX_ gv, hash ? "%" : "@", obase->op_targ,
+ return varname(gv, hash ? "%" : "@", obase->op_targ,
keysv, index, subscript_type);
}
case OP_PADSV:
if (match && PAD_SVl(obase->op_targ) != uninit_sv)
break;
- return S_varname(aTHX_ Nullgv, "$", obase->op_targ,
+ return varname(Nullgv, "$", obase->op_targ,
Nullsv, 0, FUV_SUBSCRIPT_NONE);
case OP_GVSV:
gv = cGVOPx_gv(obase);
if (!gv || (match && GvSV(gv) != uninit_sv))
break;
- return S_varname(aTHX_ gv, "$", 0, Nullsv, 0, FUV_SUBSCRIPT_NONE);
+ return varname(gv, "$", 0, Nullsv, 0, FUV_SUBSCRIPT_NONE);
case OP_AELEMFAST:
if (obase->op_flags & OPf_SPECIAL) { /* lexical array */
if (match) {
+ SV **svp;
av = (AV*)PAD_SV(obase->op_targ);
if (!av || SvRMAGICAL(av))
break;
if (!svp || *svp != uninit_sv)
break;
}
- return S_varname(aTHX_ Nullgv, "$", obase->op_targ,
+ return varname(Nullgv, "$", obase->op_targ,
Nullsv, (I32)obase->op_private, FUV_SUBSCRIPT_ARRAY);
}
else {
if (!gv)
break;
if (match) {
+ SV **svp;
av = GvAV(gv);
if (!av || SvRMAGICAL(av))
break;
if (!svp || *svp != uninit_sv)
break;
}
- return S_varname(aTHX_ gv, "$", 0,
+ return varname(gv, "$", 0,
Nullsv, (I32)obase->op_private, FUV_SUBSCRIPT_ARRAY);
}
break;
break;
}
else {
- svp = av_fetch((AV*)sv, SvIV(cSVOPx_sv(kid)), FALSE);
+ SV ** const svp = av_fetch((AV*)sv, SvIV(cSVOPx_sv(kid)), FALSE);
if (!svp || *svp != uninit_sv)
break;
}
}
if (obase->op_type == OP_HELEM)
- return S_varname(aTHX_ gv, "%", o->op_targ,
+ return varname(gv, "%", o->op_targ,
cSVOPx_sv(kid), 0, FUV_SUBSCRIPT_HASH);
else
- return S_varname(aTHX_ gv, "@", o->op_targ, Nullsv,
+ return varname(gv, "@", o->op_targ, Nullsv,
SvIV(cSVOPx_sv(kid)), FUV_SUBSCRIPT_ARRAY);
;
}
if (obase->op_type == OP_HELEM) {
SV * const keysv = S_find_hash_subscript(aTHX_ (HV*)sv, uninit_sv);
if (keysv)
- return S_varname(aTHX_ gv, "%", o->op_targ,
+ return varname(gv, "%", o->op_targ,
keysv, 0, FUV_SUBSCRIPT_HASH);
}
else {
const I32 index = S_find_array_subscript(aTHX_ (AV*)sv, uninit_sv);
if (index >= 0)
- return S_varname(aTHX_ gv, "@", o->op_targ,
+ return varname(gv, "@", o->op_targ,
Nullsv, index, FUV_SUBSCRIPT_ARRAY);
}
if (match)
break;
- return S_varname(aTHX_ gv,
+ return varname(gv,
(o->op_type == OP_PADAV || o->op_type == OP_RV2AV)
? "@" : "%",
o->op_targ, Nullsv, 0, FUV_SUBSCRIPT_WITHIN);
gv = cGVOPx_gv(o);
if (match && GvSV(gv) != uninit_sv)
break;
- return S_varname(aTHX_ gv, "$", 0,
+ return varname(gv, "$", 0,
Nullsv, 0, FUV_SUBSCRIPT_NONE);
}
/* other possibilities not handled are:
{
SV *dsv;
char tmpbuf[64];
- char *pv;
+ const char *pv;
if (DO_UTF8(sv)) {
dsv = sv_2mortal(newSVpv("", 0));
AV *av;
SV **svp;
I32 i;
- SV *tsv = SvRV(sv);
+ SV * const tsv = SvRV(sv);
MAGIC *mg = NULL;
if (!SvMAGICAL(tsv) || !(mg = mg_find(tsv, PERL_MAGIC_backref)))
Perl_croak(aTHX_ "panic: del_backref");
stash = SvSTASH(sv);
destructor = StashHANDLER(stash,DESTROY);
if (destructor) {
- SV* tmpref = newRV(sv);
+ SV* const tmpref = newRV(sv);
SvREADONLY_on(tmpref); /* DESTROY() could be naughty */
ENTER;
PUSHSTACKi(PERLSI_DESTROY);
sv_pos_u2b(sv,&append,0);
}
} else if (SvUTF8(sv)) {
- SV *tsv = NEWSV(0,0);
+ SV * const tsv = NEWSV(0,0);
sv_gets(tsv, fp, 0);
sv_utf8_upgrade_nomg(tsv);
SvCUR_set(sv,append);
/* The fact that I don't need to downcast to char * everywhere, only in ?:
inside return suggests a const propagation bug in g++. */
if (ob && SvOBJECT(sv)) {
- char *name = HvNAME_get(SvSTASH(sv));
+ char * const name = HvNAME_get(SvSTASH(sv));
return name ? name : (char *) "__ANON__";
}
else {
SvROK_on(rv);
if (classname) {
- HV* stash = gv_stashpv(classname, TRUE);
+ HV* const stash = gv_stashpv(classname, TRUE);
(void)sv_bless(rv, stash);
}
return sv;
*/
SV*
-Perl_sv_setref_pvn(pTHX_ SV *rv, const char *classname, char *pv, STRLEN n)
+Perl_sv_setref_pvn(pTHX_ SV *rv, const char *classname, const char *pv, STRLEN n)
{
sv_setpvn(newSVrv(rv,classname), pv, n);
return rv;
{
#ifdef HAS_TM_TM_ZONE
Time_t now;
- struct tm* my_tm;
+ const struct tm* my_tm;
(void)time(&now);
my_tm = localtime(&now);
if (my_tm)
Copy(my_tm, ptm, 1, struct tm);
+#else
+ PERL_UNUSED_ARG(ptm);
#endif
}