diff options
author | Father Chrysostomos <sprout@cpan.org> | 2010-10-24 18:39:25 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-10-24 18:39:25 -0700 |
commit | 96517a90c6cb5ea3aaf4304897cd4eb1db2d2305 (patch) | |
tree | 7cde4413c78951fa527318e4c212a59adbaafcaf /hv.c | |
parent | 8752206e276cffe588c0932b5a9f2331640e8447 (diff) | |
download | perl-96517a90c6cb5ea3aaf4304897cd4eb1db2d2305.tar.gz |
Memory-management macros evaluate their arguments multiple times
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -2075,7 +2075,8 @@ Perl_hv_name_add(pTHX_ HV *hv, const char *name, U32 len) if ( HEK_LEN(*hekp) == (I32)len && memEQ(HEK_KEY(*hekp), name, len) ) return; - Renewc(aux->xhv_name, ++aux->xhv_name_count, HEK *, HEK); + aux->xhv_name_count++; + Renewc(aux->xhv_name, aux->xhv_name_count, HEK *, HEK); ((HEK **)aux->xhv_name)[count] = share_hek(name, len, hash); } else { @@ -2084,7 +2085,8 @@ Perl_hv_name_add(pTHX_ HV *hv, const char *name, U32 len) HEK_LEN(existing_name) == (I32)len && memEQ(HEK_KEY(existing_name), name, len) ) return; - Newxc(aux->xhv_name, aux->xhv_name_count = 2, HEK *, HEK); + Newxc(aux->xhv_name, 2, HEK *, HEK); + aux->xhv_name_count = 2; *(HEK **)aux->xhv_name = existing_name; ((HEK **)aux->xhv_name)[1] = share_hek(name, len, hash); } |