#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
}
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);
*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);
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];
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;
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;
}