diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-07-04 10:41:28 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-07-04 10:41:28 +0000 |
commit | c941fb51a763b50ea8ceb343cf253ac80c4ca160 (patch) | |
tree | e3923132118175b9d3272c720085ce2029063592 | |
parent | 5bbd0522c4c5905125a88093d72f772779b14682 (diff) | |
download | perl-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.fnc | 1 | ||||
-rw-r--r-- | embed.h | 2 | ||||
-rw-r--r-- | hv.c | 31 | ||||
-rw-r--r-- | proto.h | 3 |
4 files changed, 15 insertions, 22 deletions
@@ -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 @@ -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) @@ -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 @@ -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__ |