* lib/hash.h, lib/hash.c (__P): Renamed to PARAMS; canonical definition used.

This commit is contained in:
Tim Van Holder
2002-01-11 15:26:56 +00:00
parent d9e9746c06
commit a10778dc32
2 changed files with 29 additions and 27 deletions

View File

@@ -24,8 +24,8 @@
#include "system.h" #include "system.h"
#include "xalloc.h" #include "xalloc.h"
static void hash_rehash __P((struct hash_table* ht)); static void hash_rehash PARAMS((struct hash_table* ht));
static unsigned long round_up_2 __P((unsigned long rough)); static unsigned long round_up_2 PARAMS((unsigned long rough));
/* Implement double hashing with open addressing. The table size is /* Implement double hashing with open addressing. The table size is
always a power of two. The secondary (`increment') hash function always a power of two. The secondary (`increment') hash function

View File

@@ -21,15 +21,17 @@
#include <stdio.h> #include <stdio.h>
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__) #ifndef PARAMS
#define __P(args) args # if defined PROTOTYPES || defined __STDC__
#else # define PARAMS(Args) Args
#define __P(args) () # else
#endif /* GCC. */ # define PARAMS(Args) ()
# endif
#endif
typedef unsigned long (*hash_func_t) __P((void const *key)); typedef unsigned long (*hash_func_t) PARAMS((void const *key));
typedef int (*hash_cmp_func_t) __P((void const *x, void const *y)); typedef int (*hash_cmp_func_t) PARAMS((void const *x, void const *y));
typedef void (*hash_map_func_t) __P((void const *item)); typedef void (*hash_map_func_t) PARAMS((void const *item));
struct hash_table struct hash_table
{ {
@@ -45,24 +47,24 @@ struct hash_table
hash_cmp_func_t ht_compare; /* comparison function */ hash_cmp_func_t ht_compare; /* comparison function */
}; };
typedef int (*qsort_cmp_t) __P((void const *, void const *)); typedef int (*qsort_cmp_t) PARAMS((void const *, void const *));
void hash_init __P((struct hash_table *ht, unsigned long size, void hash_init PARAMS((struct hash_table *ht, unsigned long size,
hash_func_t hash_1, hash_func_t hash_2, hash_cmp_func_t hash_cmp)); hash_func_t hash_1, hash_func_t hash_2, hash_cmp_func_t hash_cmp));
void hash_load __P((struct hash_table *ht, void *item_table, void hash_load PARAMS((struct hash_table *ht, void *item_table,
unsigned long cardinality, unsigned long size)); unsigned long cardinality, unsigned long size));
void **hash_find_slot __P((struct hash_table *ht, void const *key)); void **hash_find_slot PARAMS((struct hash_table *ht, void const *key));
void *hash_find_item __P((struct hash_table *ht, void const *key)); void *hash_find_item PARAMS((struct hash_table *ht, void const *key));
const void *hash_insert __P((struct hash_table *ht, void *item)); const void *hash_insert PARAMS((struct hash_table *ht, void *item));
const void *hash_insert_at __P((struct hash_table *ht, void *item, void const *slot)); const void *hash_insert_at PARAMS((struct hash_table *ht, void *item, void const *slot));
const void *hash_delete __P((struct hash_table *ht, void const *item)); const void *hash_delete PARAMS((struct hash_table *ht, void const *item));
const void *hash_delete_at __P((struct hash_table *ht, void const *slot)); const void *hash_delete_at PARAMS((struct hash_table *ht, void const *slot));
void hash_delete_items __P((struct hash_table *ht)); void hash_delete_items PARAMS((struct hash_table *ht));
void hash_free_items __P((struct hash_table *ht)); void hash_free_items PARAMS((struct hash_table *ht));
void hash_free __P((struct hash_table *ht, int free_items)); void hash_free PARAMS((struct hash_table *ht, int free_items));
void hash_map __P((struct hash_table *ht, hash_map_func_t map)); void hash_map PARAMS((struct hash_table *ht, hash_map_func_t map));
void hash_print_stats __P((struct hash_table *ht, FILE *out_FILE)); void hash_print_stats PARAMS((struct hash_table *ht, FILE *out_FILE));
void **hash_dump __P((struct hash_table *ht, void **vector_0, qsort_cmp_t compare)); void **hash_dump PARAMS((struct hash_table *ht, void **vector_0, qsort_cmp_t compare));
extern void *hash_deleted_item; extern void *hash_deleted_item;
#define HASH_VACANT(item) \ #define HASH_VACANT(item) \