more change for PMC
[IRC.git] / Robust / src / Runtime / GenericHashtable.c
index a3f838ca47a84dc087c4d879202c607e21e1bc05..f00ac00dbc89657678ff22581e05b9c7cd2070c8 100755 (executable)
@@ -1,7 +1,9 @@
 #include <stdio.h>
 #include <sys/types.h>
+#ifndef MULTICORE
 #include <sys/stat.h>
 #include <fcntl.h>
+#endif
 #include <stdlib.h>
 #include <limits.h>
 
@@ -49,11 +51,11 @@ int genputtable(struct genhashtable *ht, void * key, void * object) {
     for(i=0; i<oldcurrentsize; i++) {
       struct genpointerlist * tmpptr=oldbins[i];
       while(tmpptr!=NULL) {
-       unsigned int hashcode=genhashfunction(ht, tmpptr->src);
-       struct genpointerlist *nextptr=tmpptr->next;
-       tmpptr->next=newbins[hashcode];
-       newbins[hashcode]=tmpptr;
-       tmpptr=nextptr;
+        unsigned int hashcode=genhashfunction(ht, tmpptr->src);
+        struct genpointerlist *nextptr=tmpptr->next;
+        tmpptr->next=newbins[hashcode];
+        newbins[hashcode]=tmpptr;
+        tmpptr=nextptr;
       }
     }
     ht->bins=newbins;
@@ -94,11 +96,11 @@ int genputtable_I(struct genhashtable *ht, void * key, void * object) {
     for(i=0; i<oldcurrentsize; i++) {
       struct genpointerlist * tmpptr=oldbins[i];
       while(tmpptr!=NULL) {
-       unsigned int hashcode=genhashfunction(ht, tmpptr->src);
-       struct genpointerlist *nextptr=tmpptr->next;
-       tmpptr->next=newbins[hashcode];
-       newbins[hashcode]=tmpptr;
-       tmpptr=nextptr;
+        unsigned int hashcode=genhashfunction(ht, tmpptr->src);
+        struct genpointerlist *nextptr=tmpptr->next;
+        tmpptr->next=newbins[hashcode];
+        newbins[hashcode]=tmpptr;
+        tmpptr=nextptr;
       }
     }
     ht->bins=newbins;
@@ -115,7 +117,7 @@ int hashsize(struct genhashtable *ht) {
 void genrehash(struct genhashtable * ht) {
   struct genpointerlist **newbins=(struct genpointerlist **) RUNMALLOC(sizeof (struct genpointerlist *)*ht->currentsize);
   struct genpointerlist **oldbins=ht->bins;
-  long j,i;
+  long i;
 
   for(i=0; i<ht->currentsize; i++) {
     struct genpointerlist * tmpptr=oldbins[i];
@@ -138,7 +140,7 @@ void * gengettable(struct genhashtable *ht, void * key) {
       return ptr->object;
     ptr=ptr->next;
   }
-#ifndef RAW
+#ifndef MULTICORE
   printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p\n",key);
 #endif
   return NULL;
@@ -149,12 +151,12 @@ void * getnext(struct genhashtable *ht, void * key) {
   while(ptr!=NULL) {
     if (((ht->comp_function==NULL)&&(ptr->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->src,key)))
       if (ptr->inext!=NULL) {
-       return ptr->inext->src;
+        return ptr->inext->src;
       } else
-       return NULL;
+        return NULL;
     ptr=ptr->next;
   }
-#ifndef RAW
+#ifndef MULTICORE
   printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p...\n Likely concurrent removal--bad user!!!\n",key);
 #endif
   return NULL;
@@ -198,20 +200,20 @@ void genfreekey(struct genhashtable *ht, void * key) {
       struct genpointerlist *tmpptr=ptr->next;
       ptr->next=tmpptr->next;
       if (tmpptr==ht->list)
-       ht->list=tmpptr->inext;
+        ht->list=tmpptr->inext;
       if (tmpptr==ht->last)
-       ht->last=tmpptr->iprev;
+        ht->last=tmpptr->iprev;
       if (tmpptr->iprev!=NULL)
-       tmpptr->iprev->inext=tmpptr->inext;
+        tmpptr->iprev->inext=tmpptr->inext;
       if (tmpptr->inext!=NULL)
-       tmpptr->inext->iprev=tmpptr->iprev;
+        tmpptr->inext->iprev=tmpptr->iprev;
       RUNFREE(tmpptr);
       ht->counter--;
       return;
     }
     ptr=ptr->next;
   }
-#ifndef RAW
+#ifndef MULTICORE
   printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p\n",key);
 #endif
 }
@@ -249,9 +251,9 @@ void genfreehashtable(struct genhashtable * ht) {
     if (ht->bins[i]!=NULL) {
       struct genpointerlist *genptr=ht->bins[i];
       while(genptr!=NULL) {
-       struct genpointerlist *tmpptr=genptr->next;
-       RUNFREE(genptr);
-       genptr=tmpptr;
+        struct genpointerlist *tmpptr=genptr->next;
+        RUNFREE(genptr);
+        genptr=tmpptr;
       }
     }
   }
@@ -278,7 +280,7 @@ void * gennext(struct geniterator *it) {
   if(curr->inext!=NULL)
     it->ptr=curr->inext;
   else
-    it->finished=1; /* change offsetting scheme */
+    it->finished=1;  /* change offsetting scheme */
   return curr->src;
 }