X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=sv.c;h=13b548bd5e16644fcba0fa18f5700d9396f6fb91;hb=d084306754da809cc2b5ad2a5bd3ae649c5ccd21;hp=f3940d92f61c08c570c4d4c45d21982daf76da46;hpb=8a31060d0e98afa6004d194f5c17a527289cb541;p=p5sagit%2Fp5-mst-13.2.git diff --git a/sv.c b/sv.c index f3940d9..13b548b 100644 --- a/sv.c +++ b/sv.c @@ -2875,16 +2875,6 @@ uiv_2buf(char *buf, IV iv, UV uv, int is_uv, char **peob) return ptr; } -/* sv_2pv() is now a macro using Perl_sv_2pv_flags(); - * this function provided for binary compatibility only - */ - -char * -Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp) -{ - return sv_2pv_flags(sv, lp, SV_GMAGIC); -} - /* =for apidoc sv_2pv_flags @@ -3202,14 +3192,16 @@ would lose the UTF-8'ness of the PV. void Perl_sv_copypv(pTHX_ SV *dsv, register SV *ssv) { - SV *tmpsv = sv_newmortal(); + SV *tmpsv; - if ( SvTHINKFIRST(ssv) && SvROK(ssv) && SvAMAGIC(ssv) ) { - tmpsv = AMG_CALLun(ssv,string); + if ( SvTHINKFIRST(ssv) && SvROK(ssv) && SvAMAGIC(ssv) && + (tmpsv = AMG_CALLun(ssv,string))) { if (SvTYPE(tmpsv) != SVt_RV || (SvRV(tmpsv) != SvRV(ssv))) { SvSetSV(dsv,tmpsv); return; } + } else { + tmpsv = sv_newmortal(); } { STRLEN len; @@ -3354,21 +3346,6 @@ if all the bytes have hibit clear. This is not as a general purpose byte encoding to Unicode interface: use the Encode extension for that. -=cut -*/ - -/* sv_utf8_upgrade() is now a macro using sv_utf8_upgrade_flags(); - * this function provided for binary compatibility only - */ - - -STRLEN -Perl_sv_utf8_upgrade(pTHX_ register SV *sv) -{ - return sv_utf8_upgrade_flags(sv, SV_GMAGIC); -} - -/* =for apidoc sv_utf8_upgrade_flags Convert the PV of an SV to its UTF8-encoded form. @@ -3552,21 +3529,6 @@ You probably want to use one of the assortment of wrappers, such as C, C, C and C. - -=cut -*/ - -/* sv_setsv() is now a macro using Perl_sv_setsv_flags(); - * this function provided for binary compatibility only - */ - -void -Perl_sv_setsv(pTHX_ SV *dstr, register SV *sstr) -{ - sv_setsv_flags(dstr, sstr, SV_GMAGIC); -} - -/* =for apidoc sv_setsv_flags Copies the contents of the source SV C into the destination SV @@ -4286,20 +4248,6 @@ C indicates number of bytes to copy. If the SV has the UTF8 status set, then the bytes appended should be valid UTF8. Handles 'get' magic, but not 'set' magic. See C. -=cut -*/ - -/* sv_catpvn() is now a macro using Perl_sv_catpvn_flags(); - * this function provided for binary compatibility only - */ - -void -Perl_sv_catpvn(pTHX_ SV *dsv, const char* sstr, STRLEN slen) -{ - sv_catpvn_flags(dsv, sstr, slen, SV_GMAGIC); -} - -/* =for apidoc sv_catpvn_flags Concatenates the string onto the end of the string which is in the SV. The @@ -4351,19 +4299,6 @@ Concatenates the string from SV C onto the end of the string in SV C. Modifies C but not C. Handles 'get' magic, but not 'set' magic. See C. -=cut */ - -/* sv_catsv() is now a macro using Perl_sv_catsv_flags(); - * this function provided for binary compatibility only - */ - -void -Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr) -{ - sv_catsv_flags(dstr, sstr, SV_GMAGIC); -} - -/* =for apidoc sv_catsv_flags Concatenates the string from SV C onto the end of the string in @@ -4533,7 +4468,9 @@ Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, MGVTBL *vtable, (SvTYPE(obj) == SVt_PVGV && (GvSV(obj) == sv || GvHV(obj) == (HV*)sv || GvAV(obj) == (AV*)sv || GvCV(obj) == (CV*)sv || GvIOp(obj) == (IO*)sv || - GvFORM(obj) == (CV*)sv))) + GvFORM(obj) == (CV*)sv)) || + (how == PERL_MAGIC_tiedscalar && + SvROK(obj) && (SvRV(obj) == sv || GvIO(SvRV(obj)) == (IO*)sv))) { mg->mg_obj = obj; } @@ -6401,7 +6338,7 @@ Perl_newSVpvn_share(pTHX_ const char *src, I32 len, U32 hash) len = tmplen; } if (!hash) - PERL_HASH(hash, src, len); + PERL_HASH(hash, (U8*)src, len); new_SV(sv); sv_upgrade(sv, SVt_PVIV); SvPVX(sv) = sharepvn(src, is_utf8?-len:len, hash); @@ -6661,8 +6598,14 @@ Perl_sv_reset(pTHX_ register char *s, HV *stash) if (GvHV(gv) && !HvNAME(GvHV(gv))) { hv_clear(GvHV(gv)); #ifdef USE_ENVIRON_ARRAY - if (gv == PL_envgv) + if (gv == PL_envgv +# ifdef USE_ITHREADS + && PL_curinterp == aTHX +# endif + ) + { environ[0] = Nullch; + } #endif } } @@ -6893,26 +6836,6 @@ Perl_sv_nv(pTHX_ register SV *sv) Use the C macro instead -=cut -*/ - -/* sv_pv() is now a macro using SvPV_nolen(); - * this function provided for binary compatibility only - */ - - -char * -Perl_sv_pv(pTHX_ SV *sv) -{ - STRLEN n_a; - - if (SvPOK(sv)) - return SvPVX(sv); - - return sv_2pv(sv, &n_a); -} - -/* =for apidoc sv_pvn A private implementation of the C macro for compilers which can't @@ -6949,20 +6872,6 @@ Get a sensible string out of the SV somehow. A private implementation of the C macro for compilers which can't cope with complex macro expressions. Always use the macro instead. -=cut -*/ - -/* sv_pvn_force() is now a macro using Perl_sv_pvn_force_flags(); - * this function provided for binary compatibility only - */ - -char * -Perl_sv_pvn_force(pTHX_ SV *sv, STRLEN *lp) -{ - return sv_pvn_force_flags(sv, lp, SV_GMAGIC); -} - -/* =for apidoc sv_pvn_force_flags Get a sensible string out of the SV somehow. @@ -7019,22 +6928,6 @@ Perl_sv_pvn_force_flags(pTHX_ SV *sv, STRLEN *lp, I32 flags) Use C instead. -=cut -*/ - -/* sv_pvbyte () is now a macro using Perl_sv_2pv_flags(); - * this function provided for binary compatibility only - */ - - -char * -Perl_sv_pvbyte(pTHX_ SV *sv) -{ - sv_utf8_downgrade(sv,0); - return sv_pv(sv); -} - -/* =for apidoc sv_pvbyten A private implementation of the C macro for compilers @@ -7073,21 +6966,6 @@ Perl_sv_pvbyten_force(pTHX_ SV *sv, STRLEN *lp) Use the C macro instead -=cut -*/ -/* sv_pvutf8 () is now a macro using Perl_sv_2pv_flags(); - * this function provided for binary compatibility only - */ - - -char * -Perl_sv_pvutf8(pTHX_ SV *sv) -{ - sv_utf8_upgrade(sv); - return sv_pv(sv); -} - -/* =for apidoc sv_pvutf8n A private implementation of the C macro for compilers @@ -7422,9 +7300,6 @@ Perl_sv_bless(pTHX_ SV *sv, HV *stash) } /* Downgrades a PVGV to a PVMG. - * - * XXX This function doesn't actually appear to be used anywhere - * DAPM 15-Jun-01 */ STATIC void @@ -7552,44 +7427,6 @@ Perl_sv_tainted(pTHX_ SV *sv) return FALSE; } -/* -=for apidoc sv_setpviv - -Copies an integer into the given SV, also updating its string value. -Does not handle 'set' magic. See C. - -=cut -*/ - -void -Perl_sv_setpviv(pTHX_ SV *sv, IV iv) -{ - char buf[TYPE_CHARS(UV)]; - char *ebuf; - char *ptr = uiv_2buf(buf, iv, 0, 0, &ebuf); - - sv_setpvn(sv, ptr, ebuf - ptr); -} - -/* -=for apidoc sv_setpviv_mg - -Like C, but also handles 'set' magic. - -=cut -*/ - -void -Perl_sv_setpviv_mg(pTHX_ SV *sv, IV iv) -{ - char buf[TYPE_CHARS(UV)]; - char *ebuf; - char *ptr = uiv_2buf(buf, iv, 0, 0, &ebuf); - - sv_setpvn(sv, ptr, ebuf - ptr); - SvSETMAGIC(sv); -} - #if defined(PERL_IMPLICIT_CONTEXT) /* pTHX_ magic can't cope with varargs, so this is a no-context