From: Nicholas Clark Date: Sun, 14 Dec 2003 15:32:32 +0000 (+0000) Subject: Clean up a bug I introduced into caseless ENV hv_delete X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8167a60add3f75b2a48bb3ae0fdd7f9d853bcbdd;p=p5sagit%2Fp5-mst-13.2.git Clean up a bug I introduced into caseless ENV hv_delete (should be the proper fix for 21870 and 21872's band aid) p4raw-id: //depot/perl@21904 --- diff --git a/hv.c b/hv.c index 78b1f9d..7115332 100644 --- a/hv.c +++ b/hv.c @@ -902,25 +902,20 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, } return Nullsv; /* element cannot be deleted */ } - } #ifdef ENV_IS_CASELESS - if (mg_find((SV*)hv, PERL_MAGIC_env)) { - /* XXX This code isn't UTF8 clean. */ - keysv = sv_2mortal(newSVpvn(key,klen)); - key = strupr(SvPVX(keysv)); - -#if 0 - /* keysave not in scope - don't understand - NI-S */ - if (k_flags & HVhek_FREEKEY) { - Safefree(keysave); + else if (mg_find((SV*)hv, PERL_MAGIC_env)) { + /* XXX This code isn't UTF8 clean. */ + keysv = sv_2mortal(newSVpvn(key,klen)); + if (k_flags & HVhek_FREEKEY) { + Safefree(key); + } + key = strupr(SvPVX(keysv)); + is_utf8 = 0; + k_flags = 0; + hash = 0; } #endif - - is_utf8 = 0; - k_flags = 0; - hash = 0; } -#endif } } xhv = (XPVHV*)SvANY(hv);