Compute hash only once.
gisle
20 years ago
0 | /* $Id: hparser.c,v 2.94 2004/04/01 11:47:27 gisle Exp $ | |
0 | /* $Id: hparser.c,v 2.95 2004/04/01 11:56:37 gisle Exp $ | |
1 | 1 | * |
2 | 2 | * Copyright 1999-2002, Gisle Aas |
3 | 3 | * Copyright 1999-2000, Michael A. Chase |
413 | 413 | sv_lower(aTHX_ attrname); |
414 | 414 | |
415 | 415 | if (argcode == ARG_ATTR) { |
416 | if (hv_exists_ent(hv, attrname, 0) || | |
417 | !hv_store_ent(hv, attrname, attrval, 0)) { | |
416 | U32 hash; | |
417 | PERL_HASH(hash, SvPVX(attrname), SvCUR(attrname)); | |
418 | if (hv_exists_ent(hv, attrname, hash) || | |
419 | !hv_store_ent(hv, attrname, attrval, hash)) { | |
418 | 420 | SvREFCNT_dec(attrval); |
419 | 421 | } |
420 | 422 | SvREFCNT_dec(attrname); |