summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-04-01 19:59:54 +0000
committerNicholas Clark <nick@ccl4.org>2008-04-01 19:59:54 +0000
commit84335ee93339f99a0959258e640fa57e9f0ba6ab (patch)
tree7c83dc66076dbcac80f82d9dbccab64fc801578a
parent27aecdc667df7df9dfe00209a819ab9abfc274ea (diff)
downloadperl-84335ee93339f99a0959258e640fa57e9f0ba6ab.tar.gz
Define sv_insert() as a wrapper to sv_insert_flags(), and move
Perl_sv_insert() to mathoms.c p4raw-id: //depot/perl@33627
-rw-r--r--embed.fnc5
-rw-r--r--embed.h2
-rw-r--r--mathoms.c8
-rw-r--r--mg.c3
-rw-r--r--proto.h4
-rw-r--r--sv.c18
-rw-r--r--sv.h3
7 files changed, 22 insertions, 21 deletions
diff --git a/embed.fnc b/embed.fnc
index a8889c4778..af39856cc2 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 57526c1f7c..df3a26c567 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 e0cefb0049..082a2ffc7f 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 3d3a6cf399..0bc79798f1 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 67e4913c0a..33977b8649 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 60d11a100e..03925a48b8 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<sv_insert>, but the extra C<flags> are passed the C<SvPV_force_flags> that applies to C<bigstr>.
@@ -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 fc67ed9aba..450670683c 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) \