From: Nicholas Clark Date: Tue, 1 Apr 2008 19:59:54 +0000 (+0000) Subject: Define sv_insert() as a wrapper to sv_insert_flags(), and move X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=84335ee93339f99a0959258e640fa57e9f0ba6ab;p=p5sagit%2Fp5-mst-13.2.git Define sv_insert() as a wrapper to sv_insert_flags(), and move Perl_sv_insert() to mathoms.c p4raw-id: //depot/perl@33627 --- diff --git a/embed.fnc b/embed.fnc index a8889c4..af39856 100644 --- a/embed.fnc +++ b/embed.fnc @@ -882,8 +882,9 @@ pd |void |sv_free_arenas Apd |char* |sv_gets |NN SV *const sv|NN PerlIO *const fp|I32 append Apd |char* |sv_grow |NN SV *const sv|STRLEN newlen Apd |void |sv_inc |NULLOK SV *const sv -Apd |void |sv_insert |NN SV *const bigstr|const STRLEN offset|const STRLEN len \ - |NN const char *const little|const STRLEN littlelen +Amdb |void |sv_insert |NN SV *const bigstr|const STRLEN offset \ + |const STRLEN len|NN const char *const little \ + |const STRLEN littlelen Apd |void |sv_insert_flags|NN SV *const bigstr|const STRLEN offset|const STRLEN len \ |NN const char *const little|const STRLEN littlelen|const U32 flags Apd |int |sv_isa |NULLOK SV* sv|NN const char *const name diff --git a/embed.h b/embed.h index 57526c1..df3a26c 100644 --- a/embed.h +++ b/embed.h @@ -885,7 +885,6 @@ #define sv_gets Perl_sv_gets #define sv_grow Perl_sv_grow #define sv_inc Perl_sv_inc -#define sv_insert Perl_sv_insert #define sv_insert_flags Perl_sv_insert_flags #define sv_isa Perl_sv_isa #define sv_isobject Perl_sv_isobject @@ -3188,7 +3187,6 @@ #define sv_gets(a,b,c) Perl_sv_gets(aTHX_ a,b,c) #define sv_grow(a,b) Perl_sv_grow(aTHX_ a,b) #define sv_inc(a) Perl_sv_inc(aTHX_ a) -#define sv_insert(a,b,c,d,e) Perl_sv_insert(aTHX_ a,b,c,d,e) #define sv_insert_flags(a,b,c,d,e,f) Perl_sv_insert_flags(aTHX_ a,b,c,d,e,f) #define sv_isa(a,b) Perl_sv_isa(aTHX_ a,b) #define sv_isobject(a) Perl_sv_isobject(aTHX_ a) diff --git a/mathoms.c b/mathoms.c index e0cefb0..082a2ff 100644 --- a/mathoms.c +++ b/mathoms.c @@ -1461,6 +1461,14 @@ Perl_newHV(pTHX) return hv; } +void +Perl_sv_insert(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len, + const char *const little, const STRLEN littlelen) +{ + PERL_ARGS_ASSERT_SV_INSERT; + sv_insert_flags(bigstr, offset, len, little, littlelen, SV_GMAGIC); +} + #endif /* NO_MATHOMS */ /* diff --git a/mg.c b/mg.c index 3d3a6cf..0bc7979 100644 --- a/mg.c +++ b/mg.c @@ -1560,7 +1560,8 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) * tell whether HINT_STRICT_REFS is in force or not. */ if (!strchr(s,':') && !strchr(s,'\'')) - Perl_sv_insert(aTHX_ sv, 0, 0, STR_WITH_LEN("main::")); + Perl_sv_insert_flags(aTHX_ sv, 0, 0, STR_WITH_LEN("main::"), + SV_GMAGIC); if (i) (void)rsignal(i, PL_csighandlerp); else diff --git a/proto.h b/proto.h index 67e4913..33977b8 100644 --- a/proto.h +++ b/proto.h @@ -3179,9 +3179,9 @@ PERL_CALLCONV char* Perl_sv_grow(pTHX_ SV *const sv, STRLEN newlen) assert(sv) PERL_CALLCONV void Perl_sv_inc(pTHX_ SV *const sv); -PERL_CALLCONV void Perl_sv_insert(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len, const char *const little, const STRLEN littlelen) +/* PERL_CALLCONV void Perl_sv_insert(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len, const char *const little, const STRLEN littlelen) __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_4); + __attribute__nonnull__(pTHX_4); */ #define PERL_ARGS_ASSERT_SV_INSERT \ assert(bigstr); assert(little) diff --git a/sv.c b/sv.c index 60d11a1..03925a4 100644 --- a/sv.c +++ b/sv.c @@ -5142,18 +5142,6 @@ Perl_sv_kill_backrefs(pTHX_ SV *const sv, AV *const av) Inserts a string at the specified offset/length within the SV. Similar to the Perl substr() function. Handles get magic. -=cut -*/ - -void -Perl_sv_insert(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len, - const char *const little, const STRLEN littlelen) -{ - PERL_ARGS_ASSERT_SV_INSERT; - sv_insert_flags(bigstr, offset, len, little, littlelen, SV_GMAGIC); -} - -/* =for apidoc sv_insert_flags Same as C, but the extra C are passed the C that applies to C. @@ -12325,8 +12313,10 @@ S_varname(pTHX_ GV *gv, const char gvtype, PADOFFSET targ, *SvPVX(name) = '$'; Perl_sv_catpvf(aTHX_ name, "[%"IVdf"]", (IV)aindex); } - else if (subscript_type == FUV_SUBSCRIPT_WITHIN) - Perl_sv_insert(aTHX_ name, 0, 0, STR_WITH_LEN("within ")); + else if (subscript_type == FUV_SUBSCRIPT_WITHIN) { + /* We know that name has no magic, so can use 0 instead of SV_GMAGIC */ + Perl_sv_insert_flags(aTHX_ name, 0, 0, STR_WITH_LEN("within "), 0); + } return name; } diff --git a/sv.h b/sv.h index fc67ed9..4506706 100644 --- a/sv.h +++ b/sv.h @@ -1778,6 +1778,9 @@ mg.c:1024: warning: left-hand operand of comma expression has no effect #define sv_utf8_upgrade(sv) sv_utf8_upgrade_flags(sv, SV_GMAGIC) #define sv_2iv(sv) sv_2iv_flags(sv, SV_GMAGIC) #define sv_2uv(sv) sv_2uv_flags(sv, SV_GMAGIC) +#define sv_insert(bigstr, offset, len, little, littlelen) \ + Perl_sv_insert_flags(aTHX_ (bigstr),(offset), (len), (little), \ + (littlelen), SV_GMAGIC) /* Should be named SvCatPVN_utf8_upgrade? */ #define sv_catpvn_utf8_upgrade(dsv, sstr, slen, nsv) \