more change for PMC
[IRC.git] / Robust / src / Runtime / ObjectHash.c
index 8312857dcb49e003cb324f8698df804797bd04b3..b0e8d077613866950568467e4e7a36009effd35a 100755 (executable)
@@ -1,9 +1,12 @@
 #include "ObjectHash.h"
 #ifdef MULTICORE
+#include "methodheaders.h"
 #include "runtime_arch.h"
+#include "multicoreruntime.h"
 #else
 #include <stdio.h>
 #endif
+
 #ifdef DMALLOC
 #include "dmalloc.h"
 #endif
@@ -22,10 +25,10 @@ struct ObjectHash * noargallocateObjectHash() {
 }
 
 struct ObjectHash * allocateObjectHash(int size) {
-  struct ObjectHash *thisvar;  //=(struct ObjectHash *)RUNMALLOC(sizeof(struct ObjectHash));
+  struct ObjectHash *thisvar;
   if (size <= 0) {
 #ifdef MULTICORE
-    BAMBOO_EXIT(0xc001);
+    BAMBOO_EXIT();
 #else
     printf("Negative Hashtable size Exception\n");
     exit(-1);
@@ -73,14 +76,14 @@ int ObjectHashremove(struct ObjectHash *thisvar, int key) {
       *ptr=(*ptr)->next;
 
       if (toremove->lprev!=NULL) {
-       toremove->lprev->lnext=toremove->lnext;
+        toremove->lprev->lnext=toremove->lnext;
       } else {
-       thisvar->listhead=toremove->lnext;
+        thisvar->listhead=toremove->lnext;
       }
       if (toremove->lnext!=NULL) {
-       toremove->lnext->lprev=toremove->lprev;
+        toremove->lnext->lprev=toremove->lprev;
       } else {
-       thisvar->listtail=toremove->lprev;
+        thisvar->listtail=toremove->lprev;
       }
       RUNFREE(toremove);
 
@@ -99,7 +102,7 @@ void ObjectHashrehash(struct ObjectHash * thisvar) {
   int i;
   for(i=thisvar->size-1; i>=0; i--) {
     struct ObjectNode *ptr;
-    for(ptr=thisvar->bucket[i]; ptr!=NULL;) {
+    for(ptr=thisvar->bucket[i]; ptr!=NULL; ) {
       struct ObjectNode * nextptr=ptr->next;
       unsigned int newhashkey=(unsigned int)ptr->key % newsize;
       ptr->next=newbucket[newhashkey];
@@ -123,12 +126,12 @@ int ObjectHashadd(struct ObjectHash * thisvar,int key, int data, int data2, int
     int i;
     for(i=thisvar->size-1; i>=0; i--) {
       struct ObjectNode *ptr;
-      for(ptr=thisvar->bucket[i]; ptr!=NULL;) {
-       struct ObjectNode * nextptr=ptr->next;
-       unsigned int newhashkey=(unsigned int)ptr->key % newsize;
-       ptr->next=newbucket[newhashkey];
-       newbucket[newhashkey]=ptr;
-       ptr=nextptr;
+      for(ptr=thisvar->bucket[i]; ptr!=NULL; ) {
+        struct ObjectNode * nextptr=ptr->next;
+        unsigned int newhashkey=(unsigned int)ptr->key % newsize;
+        ptr->next=newbucket[newhashkey];
+        newbucket[newhashkey]=ptr;
+        ptr=nextptr;
       }
     }
     thisvar->size=newsize;
@@ -177,16 +180,16 @@ int ObjectHashadd_I(struct ObjectHash * thisvar,int key, int data, int data2, in
     int i;
     for(i=thisvar->size-1; i>=0; i--) {
       struct ObjectNode *ptr;
-      for(ptr=thisvar->bucket[i]; ptr!=NULL;) {
-       struct ObjectNode * nextptr=ptr->next;
-       unsigned int newhashkey=(unsigned int)ptr->key % newsize;
-       ptr->next=newbucket[newhashkey];
-       newbucket[newhashkey]=ptr;
-       ptr=nextptr;
+      for(ptr=thisvar->bucket[i]; ptr!=NULL; ) {
+        struct ObjectNode * nextptr=ptr->next;
+        unsigned int newhashkey=(unsigned int)ptr->key % newsize;
+        ptr->next=newbucket[newhashkey];
+        newbucket[newhashkey]=ptr;
+        ptr=nextptr;
       }
     }
     thisvar->size=newsize;
-    RUNFREE(thisvar->bucket);
+    RUNFREE_I(thisvar->bucket);
     thisvar->bucket=newbucket;
   }