Ap |GV* |gv_fetchsv|SV *name|I32 flags|I32 sv_type
dp |bool |is_gv_magical_sv|SV *name|U32 flags
+Apd |char* |savesvpv |SV* sv
+
END_EXTERN_C
#ifdef PERL_CORE
#define is_gv_magical_sv Perl_is_gv_magical_sv
#endif
+#define savesvpv Perl_savesvpv
#define ck_anoncode Perl_ck_anoncode
#define ck_bitop Perl_ck_bitop
#define ck_concat Perl_ck_concat
#ifdef PERL_CORE
#define is_gv_magical_sv(a,b) Perl_is_gv_magical_sv(aTHX_ a,b)
#endif
+#define savesvpv(a) Perl_savesvpv(aTHX_ a)
#define ck_anoncode(a) Perl_ck_anoncode(aTHX_ a)
#define ck_bitop(a) Perl_ck_bitop(aTHX_ a)
#define ck_concat(a) Perl_ck_concat(aTHX_ a)
Perl_hv_scalar
Perl_gv_fetchpvn_flags
Perl_gv_fetchsv
+Perl_savesvpv
if (PL_inplace)
Safefree(PL_inplace);
if (SvOK(sv))
- PL_inplace = savepv(SvPV(sv,len));
+ PL_inplace = savesvpv(sv);
else
PL_inplace = Nullch;
break;
}
if (SvOK(sv)) {
TAINT_PROPER("assigning to $^O");
- PL_osname = savepv(SvPV(sv,len));
+ PL_osname = savesvpv(sv);
}
}
else if (strEQ(mg->mg_ptr, "\017PEN")) {
break;
case '^':
Safefree(IoTOP_NAME(GvIOp(PL_defoutgv)));
- IoTOP_NAME(GvIOp(PL_defoutgv)) = s = savepv(SvPV(sv,len));
+ IoTOP_NAME(GvIOp(PL_defoutgv)) = s = savesvpv(sv);
IoTOP_GV(GvIOp(PL_defoutgv)) = gv_fetchsv(sv,TRUE, SVt_PVIO);
break;
case '~':
Safefree(IoFMT_NAME(GvIOp(PL_defoutgv)));
- IoFMT_NAME(GvIOp(PL_defoutgv)) = s = savepv(SvPV(sv,len));
+ IoFMT_NAME(GvIOp(PL_defoutgv)) = s = savesvpv(sv);
IoFMT_GV(GvIOp(PL_defoutgv)) = gv_fetchsv(sv,TRUE, SVt_PVIO);
break;
case '=':
case '#':
if (PL_ofmt)
Safefree(PL_ofmt);
- PL_ofmt = savepv(SvPV(sv,len));
+ PL_ofmt = savesvpv(sv);
break;
case '[':
PL_compiling.cop_arybase = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
topgv = gv_fetchsv(topname, FALSE, SVt_PVFM);
if ((topgv && GvFORM(topgv)) ||
!gv_fetchpv("top",FALSE,SVt_PVFM))
- IoTOP_NAME(io) = savepv(SvPVX(topname));
+ IoTOP_NAME(io) = savesvpv(topname);
else
IoTOP_NAME(io) = savepv("top");
}
PERL_CALLCONV GV* Perl_gv_fetchsv(pTHX_ SV *name, I32 flags, I32 sv_type);
PERL_CALLCONV bool Perl_is_gv_magical_sv(pTHX_ SV *name, U32 flags);
+PERL_CALLCONV char* Perl_savesvpv(pTHX_ SV* sv);
+
END_EXTERN_C
}
{
- char *s = savepv(SvPVX(lv));
+ char *s = savesvpv(lv);
char *origs = s;
while(*s && *s != '\n') s++;
}
else
{
- version = savepv(SvPV_nolen(ver));
+ version = savesvpv(ver);
}
(void)scan_version(version,vs,TRUE);
Safefree(version);
return strcpy(newaddr,pv);
}
+/*
+=for apidoc savesvpv
+
+A version of C<savepv()>/C<savepvn() which gets the string to duplicate from
+the passed in SV using C<SvPV()>
+
+=cut
+*/
+
+char *
+Perl_savesvpv(pTHX_ SV *sv)
+{
+ STRLEN len;
+ const char *pv = SvPV(sv, len);
+ register char *newaddr;
+
+ New(903,newaddr,++len,char);
+ return CopyD(pv,newaddr,len,char);
+}
/* the SV for Perl_form() and mess() is not kept in an arena */
#endif
else /* must be a string or something like a string */
{
- STRLEN n_a;
- version = savepv(SvPV(ver,n_a));
+ version = savesvpv(ver);
}
(void)scan_version(version, ver, qv);
Safefree(version);