{
hashtItem *htip;
- htip = Safe_calloc (1, sizeof (hashtItem));
+ htip = Safe_alloc ( sizeof (hashtItem));
htip->key = key;
htip->pkey = pkey;
{
hTab *htab;
- htab = Safe_calloc (1, sizeof (hTab));
+ htab = Safe_alloc ( sizeof (hTab));
- if (!(htab->table = calloc ((size + 1), sizeof (hashtItem *))))
+ if (!(htab->table = Safe_alloc ((size + 1) * sizeof (hashtItem *))))
{
fprintf (stderr, "out of virtual memory %s %d\n",
- __FILE__, (size + 1) * sizeof (hashtItem *));
+ __FILE__, (size + 1) * (int) sizeof (hashtItem *));
exit (1);
}
htab->minKey = htab->size = size;
jn = jc->next;
while (jc)
{
- free (jc);
+ Safe_free (jc);
if ((jc = jn))
jn = jc->next;
}
p->table[i] = NULL;
}
- free (p->table);
+ Safe_free (p->table);
}
}
return htip->item;
}
+/*-----------------------------------------------------------------*/
+/* hTabMaxKey - return the maxKey of item in the hashTable */
+/*-----------------------------------------------------------------*/
+int hTabMaxKey (hTab *htab)
+{
+ return (htab ? htab->maxKey : 0);
+}
+
/*-----------------------------------------------------------------*/
/*hTabAddItemIfNotP - adds an item with nothing found with key */
/*-----------------------------------------------------------------*/
/* First, delete any that currently exist */
hTabDeleteByKey (h, key, szKey, _compare);
/* Now add in ours */
- hTabAddItemLong (h, key, gc_strdup (szKey), gc_strdup (szValue));
+ hTabAddItemLong (h, key, Safe_strdup (szKey), Safe_strdup (szValue));
}
const char *