Apdmb |void |sv_unref |NN SV* sv
Apd |void |sv_unref_flags |NN SV* sv|U32 flags
Apd |void |sv_untaint |NN SV* sv
-Apd |void |sv_upgrade |NN SV* sv|U32 mt
+Apd |void |sv_upgrade |NN SV* sv|svtype new_type
Apdmb |void |sv_usepvn |NN SV* sv|NULLOK char* ptr|STRLEN len
Apd |void |sv_usepvn_flags|NN SV* sv|NULLOK char* ptr|STRLEN len\
|U32 flags
case SVt_PVIO:
Perl_croak(aTHX_ "Cannot convert a reference to %s to typeglob",
sv_reftype(has_constant, 0));
+ default: NOOP;
}
SvRV_set(gv, NULL);
SvROK_off(gv);
/* Is it a constant from cv_const_sv()? */
if (SvROK(kidsv) && SvREADONLY(kidsv)) {
SV * const rsv = SvRV(kidsv);
- const int svtype = SvTYPE(rsv);
+ const svtype type = SvTYPE(rsv);
const char *badtype = NULL;
switch (o->op_type) {
case OP_RV2SV:
- if (svtype > SVt_PVMG)
+ if (type > SVt_PVMG)
badtype = "a SCALAR";
break;
case OP_RV2AV:
- if (svtype != SVt_PVAV)
+ if (type != SVt_PVAV)
badtype = "an ARRAY";
break;
case OP_RV2HV:
- if (svtype != SVt_PVHV)
+ if (type != SVt_PVHV)
badtype = "a HASH";
break;
case OP_RV2CV:
- if (svtype != SVt_PVCV)
+ if (type != SVt_PVCV)
badtype = "a CODE";
break;
}
return PerlIO_find_layer(aTHX_ STR_WITH_LEN("Code"), 0);
case SVt_PVGV:
return PerlIO_find_layer(aTHX_ STR_WITH_LEN("Glob"), 0);
+ default:
+ return NULL;
}
- return NULL;
}
PerlIO_list_t *
SV, then copies across as much information as possible from the old body.
You generally want to use the C<SvUPGRADE> macro wrapper. See also C<svtype>.
- void sv_upgrade(SV* sv, U32 mt)
+ void sv_upgrade(SV* sv, svtype new_type)
=for hackers
Found in file sv.c
case SVt_PVFM:
case SVt_PVIO:
DIE(aTHX_ "Not a SCALAR reference");
+ default: NOOP;
}
}
else {
PERL_CALLCONV void Perl_sv_untaint(pTHX_ SV* sv)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV void Perl_sv_upgrade(pTHX_ SV* sv, U32 mt)
+PERL_CALLCONV void Perl_sv_upgrade(pTHX_ SV* sv, svtype new_type)
__attribute__nonnull__(pTHX_1);
/* PERL_CALLCONV void Perl_sv_usepvn(pTHX_ SV* sv, char* ptr, STRLEN len)
*/
void
-Perl_sv_upgrade(pTHX_ register SV *sv, U32 new_type)
+Perl_sv_upgrade(pTHX_ register SV *sv, svtype new_type)
{
dVAR;
void* old_body;
void* new_body;
- const U32 old_type = SvTYPE(sv);
+ const svtype old_type = SvTYPE(sv);
const struct body_details *new_type_details;
const struct body_details *const old_type_details
= bodies_by_type + old_type;
case SVt_PVIO:
Perl_croak(aTHX_ "Can't coerce %s to integer in %s", sv_reftype(sv,0),
OP_DESC(PL_op));
+ default: NOOP;
}
(void)SvIOK_only(sv); /* validate number */
SvIV_set(sv, i);
case SVt_PVIO:
Perl_croak(aTHX_ "Can't coerce %s to number in %s", sv_reftype(sv,0),
OP_NAME(PL_op));
+ default: NOOP;
}
SvNV_set(sv, num);
(void)SvNOK_only(sv); /* validate number */
dVAR;
register U32 sflags;
register int dtype;
- register int stype;
+ register svtype stype;
if (sstr == dstr)
return;
if (stype == SVt_PVLV)
SvUPGRADE(dstr, SVt_PVNV);
else
- SvUPGRADE(dstr, (U32)stype);
+ SvUPGRADE(dstr, (svtype)stype);
}
/* dstr may have been upgraded. */
#endif
#define SVTYPEMASK 0xff
-#define SvTYPE(sv) ((sv)->sv_flags & SVTYPEMASK)
+#define SvTYPE(sv) (svtype)((sv)->sv_flags & SVTYPEMASK)
/* Sadly there are some parts of the core that have pointers to already-freed
SV heads, and rely on being able to tell that they are now free. So mark