summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-12-31 13:54:04 +0000
committerNicholas Clark <nick@ccl4.org>2007-12-31 13:54:04 +0000
commit488344d27a84a21afc5e4f3a5237fcad050f664d (patch)
tree532046cd58be3f14c96b8af75f49e00d24f5f66d /mg.c
parentceb531cd9f4a607a106933280c868d236b5c51fa (diff)
downloadperl-488344d27a84a21afc5e4f3a5237fcad050f664d.tar.gz
Perl_magic_setbm() and Perl_magic_setfm() are mathoms that can be
merged with Perl_magic_setregexp(). [Coverage on the testsuite suggests that more than that they're actually dead code, but in theory it should be possible to construct a test case that exercises them.] p4raw-id: //depot/perl@32789
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/mg.c b/mg.c
index f341f233fe..2a1eefdbcf 100644
--- a/mg.c
+++ b/mg.c
@@ -2127,25 +2127,6 @@ Perl_magic_setmglob(pTHX_ SV *sv, MAGIC *mg)
}
int
-Perl_magic_setbm(pTHX_ SV *sv, MAGIC *mg)
-{
- PERL_UNUSED_ARG(mg);
- sv_unmagic(sv, PERL_MAGIC_bm);
- SvTAIL_off(sv);
- SvVALID_off(sv);
- return 0;
-}
-
-int
-Perl_magic_setfm(pTHX_ SV *sv, MAGIC *mg)
-{
- PERL_UNUSED_ARG(mg);
- sv_unmagic(sv, PERL_MAGIC_fm);
- SvCOMPILED_off(sv);
- return 0;
-}
-
-int
Perl_magic_setuvar(pTHX_ SV *sv, MAGIC *mg)
{
const struct ufuncs * const uf = (struct ufuncs *)mg->mg_ptr;
@@ -2158,9 +2139,16 @@ Perl_magic_setuvar(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setregexp(pTHX_ SV *sv, MAGIC *mg)
{
- PERL_UNUSED_ARG(mg);
- sv_unmagic(sv, PERL_MAGIC_qr);
- return 0;
+ const char type = mg->mg_type;
+ if (type == PERL_MAGIC_qr) {
+ } else if (type == PERL_MAGIC_bm) {
+ SvTAIL_off(sv);
+ SvVALID_off(sv);
+ } else {
+ assert(type == PERL_MAGIC_fm);
+ SvCOMPILED_off(sv);
+ }
+ return sv_unmagic(sv, type);
}
int