From ab4af70554602b5bde7d5593a6100e1d2b9582a0 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 24 Nov 2003 19:47:57 +0000 Subject: [PATCH] Tweak the order of initialisation of oentry in hv_fetch_common - C source now cleaner, but optimised object file still the same size. p4raw-id: //depot/perl@21781 --- hv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hv.c b/hv.c index 29a2cd5..a39fdcd 100644 --- 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. */ -- 1.8.3.1