summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-08-29 12:56:27 +0200
committerNicholas Clark <nick@ccl4.org>2013-09-02 16:04:02 +0200
commita6d0b1b5649bdf84d12254d7a26b63f017ff0243 (patch)
tree47bc15f1e00c1eaf58b10afb1d038ac9b90f91f0 /mg.c
parentc6e60aa38c276fbef88f69f2933902fcd2d21ebd (diff)
downloadperl-a6d0b1b5649bdf84d12254d7a26b63f017ff0243.tar.gz
Simplify some code in Perl_magic_get() and Perl_magic_set().
Remove the checks that avoided confusing $^P, ${^PREMATCH} and ${^POSTMATCH} now that the latter two do not take that code path. Remove a similar check for $^S added by commit 4ffa73a366885f68 (Feb 2003). (This commit did not add any other variable starting with a control-S.) This eliminates all uses of the variable remaining. Move the goto target do_numbuf_fetch inside the checks for PL_curpm, as both its comefroms have already made the same check.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/mg.c b/mg.c
index 20320eebe1..d0fbd47438 100644
--- a/mg.c
+++ b/mg.c
@@ -758,8 +758,8 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
if (!mg->mg_ptr) {
paren = mg->mg_len;
- do_numbuf_fetch:
if (PL_curpm && (rx = PM_GETRE(PL_curpm))) {
+ do_numbuf_fetch:
CALLREG_NUMBUF_FETCH(rx,paren,sv);
} else {
sv_setsv(sv,&PL_sv_undef);
@@ -876,12 +876,10 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
}
break;
case '\020':
- if (nextchar == '\0') { /* ^P */
- sv_setiv(sv, (IV)PL_perldb);
- }
+ sv_setiv(sv, (IV)PL_perldb);
break;
case '\023': /* ^S */
- if (nextchar == '\0') {
+ {
if (PL_parser && PL_parser->lex_state != LEX_NOTPARSING)
SvOK_off(sv);
else if (PL_in_eval)
@@ -2468,7 +2466,6 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
const char *s;
I32 paren;
const REGEXP * rx;
- const char * const remaining = mg->mg_ptr + 1;
I32 i;
STRLEN len;
MAGIC *tmg;
@@ -2601,12 +2598,9 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
}
break;
case '\020': /* ^P */
- if (*remaining == '\0') { /* ^P */
PL_perldb = SvIV(sv);
if (PL_perldb && !PL_DBsingle)
init_debugger();
- break;
- }
break;
case '\024': /* ^T */
#ifdef BIG_TIME