summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-07-04 10:41:28 +0000
committerNicholas Clark <nick@ccl4.org>2005-07-04 10:41:28 +0000
commitc941fb51a763b50ea8ceb343cf253ac80c4ca160 (patch)
treee3923132118175b9d3272c720085ce2029063592
parent5bbd0522c4c5905125a88093d72f772779b14682 (diff)
downloadperl-c941fb51a763b50ea8ceb343cf253ac80c4ca160.tar.gz
Inlining del_HE is actually a space optimisation.
It's therefore likely also to be a speed optimisation. :-) p4raw-id: //depot/perl@25066
-rw-r--r--embed.fnc1
-rw-r--r--embed.h2
-rw-r--r--hv.c31
-rw-r--r--proto.h3
4 files changed, 15 insertions, 22 deletions
diff --git a/embed.fnc b/embed.fnc
index 4340984958..5bcac5734e 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -999,7 +999,6 @@ s |void |require_errno |NN GV *gv
s |void |hsplit |NN HV *hv
s |void |hfreeentries |HV *hv
sa |HE* |new_he
-s |void |del_he |NN HE *p
sa |HEK* |save_hek_flags |NN const char *str|I32 len|U32 hash|int flags
s |void |hv_magic_check |NN HV *hv|NN bool *needs_copy|NN bool *needs_store
s |void |unshare_hek_or_pvn|NULLOK const HEK* hek|NULLOK const char* str|I32 len|U32 hash
diff --git a/embed.h b/embed.h
index 0c1bb8beb5..f8800b40f1 100644
--- a/embed.h
+++ b/embed.h
@@ -1037,7 +1037,6 @@
#define hsplit S_hsplit
#define hfreeentries S_hfreeentries
#define new_he S_new_he
-#define del_he S_del_he
#define save_hek_flags S_save_hek_flags
#define hv_magic_check S_hv_magic_check
#define unshare_hek_or_pvn S_unshare_hek_or_pvn
@@ -3014,7 +3013,6 @@
#define hsplit(a) S_hsplit(aTHX_ a)
#define hfreeentries(a) S_hfreeentries(aTHX_ a)
#define new_he() S_new_he(aTHX)
-#define del_he(a) S_del_he(aTHX_ a)
#define save_hek_flags(a,b,c,d) S_save_hek_flags(aTHX_ a,b,c,d)
#define hv_magic_check(a,b,c) S_hv_magic_check(aTHX_ a,b,c)
#define unshare_hek_or_pvn(a,b,c,d) S_unshare_hek_or_pvn(aTHX_ a,b,c,d)
diff --git a/hv.c b/hv.c
index 42c552270e..99e034ed07 100644
--- a/hv.c
+++ b/hv.c
@@ -54,6 +54,13 @@ S_more_he(pTHX)
HeNEXT(he) = 0;
}
+#ifdef PURIFY
+
+#define new_HE() (HE*)safemalloc(sizeof(HE))
+#define del_HE(p) safefree((char*)p)
+
+#else
+
STATIC HE*
S_new_he(pTHX)
{
@@ -67,24 +74,16 @@ S_new_he(pTHX)
return he;
}
-STATIC void
-S_del_he(pTHX_ HE *p)
-{
- LOCK_SV_MUTEX;
- HeNEXT(p) = (HE*)PL_he_root;
- PL_he_root = p;
- UNLOCK_SV_MUTEX;
-}
-
-#ifdef PURIFY
-
-#define new_HE() (HE*)safemalloc(sizeof(HE))
-#define del_HE(p) safefree((char*)p)
+#define new_HE() new_he()
+#define del_HE(p) \
+ STMT_START { \
+ LOCK_SV_MUTEX; \
+ HeNEXT(p) = (HE*)PL_he_root; \
+ PL_he_root = p; \
+ UNLOCK_SV_MUTEX; \
+ } STMT_END
-#else
-#define new_HE() new_he()
-#define del_HE(p) del_he(p)
#endif
diff --git a/proto.h b/proto.h
index fb8bc8a352..caaaf974c2 100644
--- a/proto.h
+++ b/proto.h
@@ -1988,9 +1988,6 @@ STATIC HE* S_new_he(pTHX)
__attribute__malloc__
__attribute__warn_unused_result__;
-STATIC void S_del_he(pTHX_ HE *p)
- __attribute__nonnull__(pTHX_1);
-
STATIC HEK* S_save_hek_flags(pTHX_ const char *str, I32 len, U32 hash, int flags)
__attribute__malloc__
__attribute__warn_unused_result__