@@ -39,17 +39,17 @@ struct st_table_entry {
39
39
static int numcmp (long , long );
40
40
static int numhash (long );
41
41
static struct st_hash_type type_numhash = {
42
- HASH_FUNCTION_CAST numcmp ,
43
- HASH_FUNCTION_CAST numhash
42
+ ( hash_function_compare ) numcmp ,
43
+ ( hash_function_hash ) numhash
44
44
};
45
45
46
46
/*
47
47
* extern int strcmp(const char *, const char *);
48
48
*/
49
49
static int strhash (const char * );
50
50
static struct st_hash_type type_strhash = {
51
- HASH_FUNCTION_CAST strcmp ,
52
- HASH_FUNCTION_CAST strhash
51
+ ( hash_function_compare ) strcmp ,
52
+ ( hash_function_hash ) strhash
53
53
};
54
54
55
55
static void rehash (st_table * );
@@ -212,7 +212,7 @@ void st_free_table(st_table *table)
212
212
}
213
213
214
214
#define PTR_NOT_EQUAL (table , ptr , hash_val , key ) \
215
- ((ptr) != 0 && (ptr->hash != (hash_val) || !EQUAL((table), (key), (ptr)->key)))
215
+ ((ptr) != 0 && (ptr->hash != (hash_val) || !EQUAL((table), (void*) ( key), (void*) (ptr)->key)))
216
216
217
217
#ifdef HASH_LOG
218
218
#define COLLISION collision++
@@ -237,7 +237,7 @@ int st_lookup(st_table *table, register st_data_t key, st_data_t *value)
237
237
unsigned int hash_val , bin_pos ;
238
238
register st_table_entry * ptr ;
239
239
240
- hash_val = do_hash (key , table );
240
+ hash_val = do_hash (( void * ) key , table );
241
241
FIND_ENTRY (table , ptr , hash_val , bin_pos );
242
242
243
243
if (ptr == 0 ) {
@@ -272,7 +272,7 @@ int st_insert(register st_table *table, register st_data_t key, st_data_t value)
272
272
unsigned int hash_val , bin_pos ;
273
273
register st_table_entry * ptr ;
274
274
275
- hash_val = do_hash (key , table );
275
+ hash_val = do_hash (( void * ) key , table );
276
276
FIND_ENTRY (table , ptr , hash_val , bin_pos );
277
277
278
278
if (ptr == 0 ) {
@@ -288,7 +288,7 @@ void st_add_direct(st_table *table,st_data_t key,st_data_t value)
288
288
{
289
289
unsigned int hash_val , bin_pos ;
290
290
291
- hash_val = do_hash (key , table );
291
+ hash_val = do_hash (( void * ) key , table );
292
292
bin_pos = hash_val % table -> num_bins ;
293
293
ADD_DIRECT (table , key , value , hash_val , bin_pos );
294
294
}
@@ -363,7 +363,7 @@ int st_delete(register st_table *table,register st_data_t *key,st_data_t *value)
363
363
st_table_entry * tmp ;
364
364
register st_table_entry * ptr ;
365
365
366
- hash_val = do_hash_bin (* key , table );
366
+ hash_val = do_hash_bin (( void * ) * key , table );
367
367
ptr = table -> bins [hash_val ];
368
368
369
369
if (ptr == 0 ) {
@@ -372,7 +372,7 @@ int st_delete(register st_table *table,register st_data_t *key,st_data_t *value)
372
372
return 0 ;
373
373
}
374
374
375
- if (EQUAL (table , * key , ptr -> key )) {
375
+ if (EQUAL (table , ( void * ) * key , ( void * ) ptr -> key )) {
376
376
table -> bins [hash_val ] = ptr -> next ;
377
377
table -> num_entries -- ;
378
378
if (value != 0 )
@@ -383,7 +383,7 @@ int st_delete(register st_table *table,register st_data_t *key,st_data_t *value)
383
383
}
384
384
385
385
for (; ptr -> next != 0 ; ptr = ptr -> next ) {
386
- if (EQUAL (table , ptr -> next -> key , * key )) {
386
+ if (EQUAL (table , ( void * ) ptr -> next -> key , ( void * ) * key )) {
387
387
tmp = ptr -> next ;
388
388
ptr -> next = ptr -> next -> next ;
389
389
table -> num_entries -- ;
@@ -403,7 +403,7 @@ int st_delete_safe(register st_table *table,register st_data_t *key,st_data_t *v
403
403
unsigned int hash_val ;
404
404
register st_table_entry * ptr ;
405
405
406
- hash_val = do_hash_bin (* key , table );
406
+ hash_val = do_hash_bin (( void * ) * key , table );
407
407
ptr = table -> bins [hash_val ];
408
408
409
409
if (ptr == 0 ) {
@@ -413,7 +413,7 @@ int st_delete_safe(register st_table *table,register st_data_t *key,st_data_t *v
413
413
}
414
414
415
415
for (; ptr != 0 ; ptr = ptr -> next ) {
416
- if ((ptr -> key != never ) && EQUAL (table , ptr -> key , * key )) {
416
+ if ((ptr -> key != never ) && EQUAL (table , ( void * ) ptr -> key , ( void * ) * key )) {
417
417
table -> num_entries -- ;
418
418
* key = ptr -> key ;
419
419
if (value != 0 )
@@ -439,11 +439,11 @@ void st_cleanup_safe(st_table *table,st_data_t never)
439
439
{
440
440
int num_entries = table -> num_entries ;
441
441
442
- st_foreach (table , HASH_FUNCTION_CAST delete_never , never );
442
+ st_foreach (table , ( hash_function_foreach ) delete_never , never );
443
443
table -> num_entries = num_entries ;
444
444
}
445
445
446
- int st_foreach (st_table * table ,int (* func ) (ANYARGS ),st_data_t arg )
446
+ int st_foreach (st_table * table ,int (* func ) (void * , void * , void * ),st_data_t arg )
447
447
{
448
448
st_table_entry * ptr , * last , * tmp ;
449
449
enum st_retval retval ;
@@ -452,7 +452,9 @@ int st_foreach(st_table *table,int (*func) (ANYARGS),st_data_t arg)
452
452
for (i = 0 ; i < table -> num_bins ; i ++ ) {
453
453
last = 0 ;
454
454
for (ptr = table -> bins [i ]; ptr != 0 ;) {
455
- retval = (enum st_retval ) (* func ) (ptr -> key , ptr -> record , arg );
455
+ retval = (enum st_retval ) (* func ) ((void * ) ptr -> key ,
456
+ (void * ) ptr -> record ,
457
+ (void * ) arg );
456
458
switch (retval ) {
457
459
case ST_CHECK : /* check if hash is modified during
458
460
* iteration */
0 commit comments