47 #if defined(LINEAR_HASHTABLE_DEBUG)
48 #define debug_assert(a) assert(a)
50 #define debug_assert(a)
53 #define debug_assert_coherent(h) debug_assert(linear_hashtable_coherent_p(h))
55 #define FREE_CHUNK ((void *) 0)
56 #define EMPTIED_CHUNK ((void *) -1)
85 index = (index+1) % h->
size;
106 fprintf(file,
"[linear_hashtable_dump] hash=%p size=%zd nitems=%zd\n",
109 for (i=0; i<h->
size; i++)
112 fprintf(file,
"%zd (%td): 0x%p -> 0x%p\n",
118 fprintf(file,
"[linear_hashtable_dump] done.\n");
137 for(i=0, n=0; i<h->
size; i++)
144 if (index!=i)
return false;
160 #define HASHTABLE_INITIAL_SIZE (17)
179 for (i=0; i<size; i++)
208 h->
size = 2*oldsize + 1;
212 for (i=0; i<h->
size; i++)
216 for (i=0; i<oldsize; i++)
218 register void * k = oldcontents[i].
key;
void linear_hashtable_dump(linear_hashtable_pt h)
convenient function to be called from gdb.
bool linear_hashtable_isin(linear_hashtable_pt h, void *k)
void linear_hashtable_put(linear_hashtable_pt h, void *k, void *v)
int linear_hashtable_nitems(linear_hashtable_pt h)
struct linear_hashtable_st * linear_hashtable_pt
hidden structure to store the hashtable.
static void linear_hashtable_internal_put(linear_hashtable_pt h, void *k, void *v, bool once)
void linear_hashtable_put_once(linear_hashtable_pt h, void *k, void *v)
bool linear_hashtable_remove(linear_hashtable_pt h, void *k)
linear_hashtable_pt linear_hashtable_make(void)
constructor.
static uintptr_t key_location(linear_hashtable_pt h, void *k, bool toget)
returns the location to put or get k in h.
#define HASHTABLE_INITIAL_SIZE
size of internal table.
bool linear_hashtable_coherent_p(linear_hashtable_pt h)
check hashtable coherency
#define debug_assert(a)
expected headers: the internal structure does not need to be available! struct linear_hashtable_st; t...
#define debug_assert_coherent(h)
static void linear_hashtable_extend(linear_hashtable_pt h)
static void linear_hashtable_print(FILE *file, linear_hashtable_pt h)
void * linear_hashtable_get(linear_hashtable_pt h, void *k)
void linear_hashtable_free(linear_hashtable_pt h)
destructor
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
hidden structure to store the hashtable.
size_t size
number of association stored
paire * contents
size of internal array