summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-07-02 12:34:08 +0000
committerNicholas Clark <nick@ccl4.org>2005-07-02 12:34:08 +0000
commit43c5f42db1e336a99904bcc798b7070727bfbd0a (patch)
tree1e02933dfd6fac99b7933947f33451769fd8467e /mg.c
parent0cf8ddea3351f0ff9eef736dfa13bc866d0d1f97 (diff)
downloadperl-43c5f42db1e336a99904bcc798b7070727bfbd0a.tar.gz
Don't check the pointer is non-NULL before calling Safefree() in
little used code, code used only once per run (such as interpreter construction and destruction), and cases where the pointer nearly never is NULL. Safefree does its own non-NULL check, and even that isn't strictly necessary as all conformant free()s accept a NULL pointer. p4raw-id: //depot/perl@25045
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/mg.c b/mg.c
index dcc3a90c24..6d820705ff 100644
--- a/mg.c
+++ b/mg.c
@@ -2215,19 +2215,12 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
PL_hints = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
break;
case '\011': /* ^I */ /* NOT \t in EBCDIC */
- if (PL_inplace)
- Safefree(PL_inplace);
- if (SvOK(sv))
- PL_inplace = savesvpv(sv);
- else
- PL_inplace = Nullch;
- break;
+ Safefree(PL_inplace);
+ PL_inplace = SvOK(sv) ? savesvpv(sv) : Nullch;
case '\017': /* ^O */
if (*(mg->mg_ptr+1) == '\0') {
- if (PL_osname) {
- Safefree(PL_osname);
- PL_osname = Nullch;
- }
+ Safefree(PL_osname);
+ PL_osname = Nullch;
if (SvOK(sv)) {
TAINT_PROPER("assigning to $^O");
PL_osname = savesvpv(sv);