-void hTabAddItem (hTab **htab, int key, void *item )
-{
- hashtItem *htip ;
- hashtItem *last ;
-
- if (!(*htab) )
- *htab = newHashTable ( DEFAULT_HTAB_SIZE );
-
- if (key > (*htab)->size ) {
- int i;
- (*htab)->table = GC_realloc ((*htab)->table,
- (key*2 + 2)*sizeof(hashtItem *));
- for ( i = (*htab)->size +1; i <= (key*2 + 1); i++ )
- (*htab)->table[i] = NULL ;
- (*htab)->size = key*2 + 1;
- }
-
- /* update the key */
- if ((*htab)->maxKey < key )
- (*htab)->maxKey = key ;
-
- if ((*htab)->minKey > key )
- (*htab)->minKey = key ;
-
- /* create the item */
- htip = newHashtItem (key,item);
-
- /* if there is a clash then goto end of chain */
- if ((last = (*htab)->table[key])) {
- while (last->next)
- last = last->next ;
- last->next = htip ;
- } else
- /* else just add it */
- (*htab)->table[key] = htip ;
- (*htab)->nItems++ ;
+void
+hTabAddItem (hTab ** htab, int key, void *item)
+{
+ hTabAddItemLong (htab, key, NULL, item);