diff options
-rw-r--r-- | src/regparse.c | 14 | ||||
-rw-r--r-- | src/st.c | 29 | ||||
-rw-r--r-- | src/st.h | 4 |
3 files changed, 31 insertions, 16 deletions
diff --git a/src/regparse.c b/src/regparse.c index 88a6ca3..d7d188a 100644 --- a/src/regparse.c +++ b/src/regparse.c @@ -548,8 +548,10 @@ typedef struct { } st_str_end_key; static int -str_end_cmp(st_str_end_key* x, st_str_end_key* y) +str_end_cmp(st_data_t ax, st_data_t ay) { + st_str_end_key* x = (st_str_end_key* )ax; + st_str_end_key* y = (st_str_end_key* )ay; UChar *p, *q; int c; @@ -569,8 +571,9 @@ str_end_cmp(st_str_end_key* x, st_str_end_key* y) } static int -str_end_hash(st_str_end_key* x) +str_end_hash(st_data_t ax) { + st_str_end_key* x = (st_str_end_key* )ax; UChar *p; unsigned val = 0; @@ -635,8 +638,10 @@ typedef struct { } st_callout_name_key; static int -callout_name_table_cmp(st_callout_name_key* x, st_callout_name_key* y) +callout_name_table_cmp(st_data_t ax, st_data_t ay) { + st_callout_name_key* x = (st_callout_name_key* )ax; + st_callout_name_key* y = (st_callout_name_key* )ay; UChar *p, *q; int c; @@ -658,8 +663,9 @@ callout_name_table_cmp(st_callout_name_key* x, st_callout_name_key* y) } static int -callout_name_table_hash(st_callout_name_key* x) +callout_name_table_hash(st_data_t ax) { + st_callout_name_key* x = (st_callout_name_key* )ax; UChar *p; unsigned int val = 0; @@ -32,18 +32,18 @@ struct st_table_entry { * */ -static int numcmp(long, long); -static int numhash(long); +static int numcmp(st_data_t, st_data_t); +static int numhash(st_data_t); static struct st_hash_type type_numhash = { numcmp, numhash, }; -/* extern int strcmp(const char *, const char *); */ -static int strhash(const char *); +static int str_cmp(st_data_t, st_data_t); +static int str_hash(st_data_t); static struct st_hash_type type_strhash = { - strcmp, - strhash, + str_cmp, + str_hash, }; static void rehash(st_table *); @@ -456,7 +456,7 @@ st_cleanup_safe(st_table* table, st_data_t never) } extern int -st_foreach(st_table* table, int (*func)(), st_data_t arg) +st_foreach(st_table* table, int (*func)(st_data_t, st_data_t, st_data_t), st_data_t arg) { st_table_entry *ptr, *last, *tmp; enum st_retval retval; @@ -503,8 +503,17 @@ st_foreach(st_table* table, int (*func)(), st_data_t arg) } static int -strhash(register const char* string) +str_cmp(st_data_t a1, st_data_t a2) { + const char* s1 = (const char* )a1; + const char* s2 = (const char* )a2; + return strcmp(s1, s2); +} + +static int +str_hash(st_data_t astring) +{ + const char* string = (const char* )astring; register int c; #ifdef HASH_ELFHASH @@ -541,13 +550,13 @@ strhash(register const char* string) } static int -numcmp(long x, long y) +numcmp(st_data_t x, st_data_t y) { return x != y; } static int -numhash(long n) +numhash(st_data_t n) { return n; } @@ -16,8 +16,8 @@ typedef unsigned long long st_data_t; typedef struct st_table st_table; struct st_hash_type { - int (*compare)(); - int (*hash)(); + int (*compare)(st_data_t, st_data_t); + int (*hash)(st_data_t); }; struct st_table { |