]> git.gag.com Git - fw/sdcc/blobdiff - src/SDCChasht.c
New Memory Allocation functions
[fw/sdcc] / src / SDCChasht.c
index 9703326569f3e1a24a673f58fbb6f5f2e77f91b4..22b453ce1a78cbe2ecaea84f7aff6a7f2a4c9338 100644 (file)
@@ -28,6 +28,7 @@
 #include <assert.h>
 #include "SDCCglobl.h"
 #include "SDCChasht.h"
+#include "newalloc.h"
 
 #define DEFAULT_HTAB_SIZE 128
 
@@ -38,7 +39,7 @@ static hashtItem *_newHashtItem (int key, void *pkey, void *item)
 {
     hashtItem *htip;
 
-    ALLOC(htip,sizeof(hashtItem));
+    htip = Safe_calloc(sizeof(hashtItem));
     
     htip->key = key ;
     htip->pkey = pkey;
@@ -54,7 +55,7 @@ hTab *newHashTable (int size)
 {
     hTab *htab;    
     
-    ALLOC(htab,sizeof(hTab));  
+    htab = Safe_calloc(sizeof(hTab));  
 
     if (!(htab->table = calloc((size +1),  sizeof(hashtItem *)))) {
        fprintf(stderr,"out of virtual memory %s %d\n",
@@ -76,7 +77,7 @@ void hTabAddItemLong(hTab **htab, int key, void *pkey, void *item)
     
     if (key > (*htab)->size ) {        
        int i;       
-       (*htab)->table = realloc ((*htab)->table, 
+       (*htab)->table = Safe_realloc ((*htab)->table, 
                                  (key*2 + 2)*sizeof(hashtItem *));
        for ( i = (*htab)->size +1; i <= (key*2 + 1); i++ )
            (*htab)->table[i] = NULL ;