From 6224148fdd809170d138216d72b8e6180d626aec Mon Sep 17 00:00:00 2001 From: xleroy Date: Wed, 17 Feb 2010 13:44:32 +0000 Subject: Reorganization test directory git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1253 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- test/ccured_olden/mst/hash.c | 105 ------------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 test/ccured_olden/mst/hash.c (limited to 'test/ccured_olden/mst/hash.c') diff --git a/test/ccured_olden/mst/hash.c b/test/ccured_olden/mst/hash.c deleted file mode 100644 index 67e460dd..00000000 --- a/test/ccured_olden/mst/hash.c +++ /dev/null @@ -1,105 +0,0 @@ -/* For copyright information, see olden_v1.0/COPYRIGHT */ - -#include "ssplain.h" -#ifdef SS_PLAIN -#include "mst.h" -#else SS_PLAIN -#include "hash.h" -#endif SS_PLAIN -#include - -#define assert(num,a) if (!(a)) {chatting("Assertion failure:%d in hash\n",num); exit(-1);} -#undef assert -#define assert(num,a) - -#ifndef CCURED - #define __NOCUREBLOCK -#endif - -#ifdef CCURED - #pragma ccuredalloc("localmalloc", nozero, sizein(1)) -#endif -static char *localmalloc(int size); - -static int remaining = 0; -static char *temp; -static char *localmalloc(int size) { - char *blah; - - if (size>remaining) - { - temp = (char *) malloc(32768); - if (!temp) chatting("Error! malloc returns null\n"); - remaining = 32768; - } - blah = temp; - temp += size; - remaining -= size; - return blah; -} - -#define localfree(sz) - -Hash MakeHash(int size, int (*map)(unsigned int)) -{ - Hash retval; - - retval = (Hash) localmalloc(sizeof(*retval)); - retval->array = (HashEntry *) localmalloc(size*sizeof(retval->array[0])); - { __NOCUREBLOCK - memset((char*)retval->array, 0, size * sizeof(retval->array[0])); - } - retval->mapfunc = map; - retval->size = size; - retval->padding = 0; - return retval; -} - -void *HashLookup(unsigned int key, Hash hash) -{ - int j; - HashEntry ent; - - j = (hash->mapfunc)(key); - assert(1,j>=0); - assert(2,jsize); - - for (ent = hash->array[j]; ent && ent->key!=key; ent=ent->next) ; - - if (ent) return ent->entry; - return NULL; -} - -void HashInsert(void *entry,unsigned int key,Hash hash) -{ - HashEntry ent; - int j; - - assert(3,!HashLookup(key,hash)); - - j = (hash->mapfunc)(key); - - ent = (HashEntry) localmalloc(sizeof(*ent)); - ent->next = hash->array[j]; - hash->array[j]=ent; - ent->key = key; - ent->entry = entry; -} - -void HashDelete(unsigned int key,Hash hash) -{ - HashEntry *ent; - HashEntry tmp; - int j; - - j = (hash->mapfunc)(key); - for (ent=&(hash->array[j]); (*ent) && (*ent)->key!=key; ent=&((*ent)->next)); - assert(4,*ent); - tmp = *ent; - *ent = (*ent)->next; - localfree(tmp); -} - - - - -- cgit