{
register HE* he;
register HE* heend;
- he_root = (HE*)safemalloc(1008);
+ New(54, he_root, 1008/sizeof(HE), HE);
he = he_root;
heend = &he[1008 / sizeof(HE) - 1];
while (he < heend) {
register U32 hash;
register HE *entry;
register HE **oentry;
+ SV **svp;
SV *sv;
if (!hv)
bool needs_store;
hv_magic_check (hv, &needs_copy, &needs_store);
- if (needs_copy) {
- sv = *hv_fetch(hv, key, klen, TRUE);
+ if (needs_copy && (svp = hv_fetch(hv, key, klen, TRUE))) {
+ sv = *svp;
mg_clear(sv);
if (!needs_store) {
if (mg_find(sv, 'p')) {
bool needs_store;
hv_magic_check (hv, &needs_copy, &needs_store);
- if (needs_copy) {
- entry = hv_fetch_ent(hv, keysv, TRUE, hash);
+ if (needs_copy && (entry = hv_fetch_ent(hv, keysv, TRUE, hash))) {
sv = HeVAL(entry);
mg_clear(sv);
if (!needs_store) {
nomemok = TRUE;
#ifdef STRANGE_MALLOC
Renew(a, newsize, HE*);
+ if (!a) {
+ nomemok = FALSE;
+ return;
+ }
#else
i = newsize * sizeof(HE*);
#define MALLOC_OVERHEAD 16
tmp /= sizeof(HE*);
assert(tmp >= newsize);
New(2,a, tmp, HE*);
+ if (!a) {
+ nomemok = FALSE;
+ return;
+ }
Copy(xhv->xhv_array, a, oldsize, HE*);
if (oldsize >= 64) {
offer_nice_chunk(xhv->xhv_array,
nomemok = TRUE;
#ifdef STRANGE_MALLOC
Renew(a, newsize, HE*);
+ if (!a) {
+ nomemok = FALSE;
+ return;
+ }
#else
i = newsize * sizeof(HE*);
j = MALLOC_OVERHEAD;
j /= sizeof(HE*);
assert(j >= newsize);
New(2, a, j, HE*);
+ if (!a) {
+ nomemok = FALSE;
+ return;
+ }
Copy(xhv->xhv_array, a, oldsize, HE*);
if (oldsize >= 64) {
offer_nice_chunk(xhv->xhv_array,