diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-07-02 12:34:08 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-07-02 12:34:08 +0000 |
commit | 43c5f42db1e336a99904bcc798b7070727bfbd0a (patch) | |
tree | 1e02933dfd6fac99b7933947f33451769fd8467e /regcomp.c | |
parent | 0cf8ddea3351f0ff9eef736dfa13bc866d0d1f97 (diff) | |
download | perl-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 'regcomp.c')
-rw-r--r-- | regcomp.c | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -6007,10 +6007,10 @@ Perl_pregfree(pTHX_ struct regexp *r) len > 60 ? "..." : ""); }); - if (r->precomp) - Safefree(r->precomp); - if (r->offsets) /* 20010421 MJD */ - Safefree(r->offsets); + /* gcov results gave these as non-null 100% of the time, so there's no + optimisation in checking them before calling Safefree */ + Safefree(r->precomp); + Safefree(r->offsets); /* 20010421 MJD */ RX_MATCH_COPY_FREE(r); #ifdef PERL_OLD_COPY_ON_WRITE if (r->saved_copy) @@ -6073,14 +6073,11 @@ Perl_pregfree(pTHX_ struct regexp *r) refcount = trie->refcount--; OP_REFCNT_UNLOCK; if ( !refcount ) { - if (trie->charmap) - Safefree(trie->charmap); + Safefree(trie->charmap); if (trie->widecharmap) SvREFCNT_dec((SV*)trie->widecharmap); - if (trie->states) - Safefree(trie->states); - if (trie->trans) - Safefree(trie->trans); + Safefree(trie->states); + Safefree(trie->trans); #ifdef DEBUGGING if (trie->words) SvREFCNT_dec((SV*)trie->words); |