This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tweak the order of initialisation of oentry in hv_fetch_common -
authorNicholas Clark <nick@ccl4.org>
Mon, 24 Nov 2003 19:47:57 +0000 (19:47 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 24 Nov 2003 19:47:57 +0000 (19:47 +0000)
C source now cleaner, but optimised object file still the same size.

p4raw-id: //depot/perl@21781

hv.c

diff --git a/hv.c b/hv.c
index 29a2cd5..a39fdcd 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -611,9 +611,8 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
     else
 #endif
     {
-       /* oentry = &(HvARRAY(hv))[hash & (I32) HvMAX(hv)]; */
-       oentry = &((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max];
-       entry = *oentry;
+       /* entry = (HvARRAY(hv))[hash & (I32) HvMAX(hv)]; */
+       entry = ((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max];
     }
     for (; entry; ++n_links, entry = HeNEXT(entry)) {
        if (HeHASH(entry) != hash)              /* strings can't be equal */
@@ -722,16 +721,17 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
 
     /* Welcome to hv_store...  */
 
-    if (!oentry) {
+    if (!xhv->xhv_array) {
        /* Not sure if we can get here.  I think the only case of oentry being
           NULL is for %ENV with dynamic env fetch.  But that should disappear
           with magic in the previous code.  */
        Newz(503, xhv->xhv_array /* HvARRAY(hv) */,
             PERL_HV_ARRAY_ALLOC_BYTES(xhv->xhv_max+1 /* HvMAX(hv)+1 */),
             char);
-       oentry = &((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max];
     }
 
+    oentry = &((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max];
+
     entry = new_HE();
     /* share_hek_flags will do the free for us.  This might be considered
        bad API design.  */