Make hash tables more const correct.

And clean up the resulting mess :/
This commit is contained in:
Bill Currie 2012-07-18 22:34:37 +09:00
parent 034139b806
commit ec42bde527
53 changed files with 104 additions and 104 deletions

View file

@ -58,7 +58,7 @@ typedef struct hashtab_s hashtab_t;
multiple inserions of the same key are fine; later insertions override
previous ones until the later one is removed (Hash_Del).
*/
hashtab_t *Hash_NewTable (int tsize, const char *(*gk)(void*,void*),
hashtab_t *Hash_NewTable (int tsize, const char *(*gk)(const void*,void*),
void (*f)(void*,void*), void *ud);
/** change the hash and compare functions used by the Hash_*Element functions.
@ -74,8 +74,8 @@ hashtab_t *Hash_NewTable (int tsize, const char *(*gk)(void*,void*),
\param gh takes the same parameters as gk in Hash_NewTable
\param cmp is element 1, element 2, userdata
*/
void Hash_SetHashCompare (hashtab_t *tab, uintptr_t (*gh)(void*,void*),
int (*cmp)(void*,void*,void*));
void Hash_SetHashCompare (hashtab_t *tab, uintptr_t (*gh)(const void*,void*),
int (*cmp)(const void*,const void*,void*));
/** delete a hash table.
@ -114,7 +114,7 @@ void *Hash_Find (hashtab_t *tab, const char *key);
\param ele element with info identifying the element being searched for
\return pointer to the element if found, otherwise 0.
*/
void *Hash_FindElement (hashtab_t *tab, void *ele);
void *Hash_FindElement (hashtab_t *tab, const void *ele);
/** find a list of elements within a hash table.
\param tab the table to search

View file

@ -56,7 +56,7 @@ static hashtab_t *snd_sfx_hash;
static cvar_t *precache;
static const char *
snd_sfx_getkey (void *sfx, void *unused)
snd_sfx_getkey (const void *sfx, void *unused)
{
return ((sfx_t *) sfx)->name;
}

View file

@ -139,7 +139,7 @@ error:
}
static const char *
menu_get_key (void *m, void *unused)
menu_get_key (const void *m, void *unused)
{
return ((menu_item_t *) m)->text;
}

View file

@ -52,7 +52,7 @@
#include "compat.h"
static const char *
builtin_get_key (void *_bi, void *unused)
builtin_get_key (const void *_bi, void *unused)
{
builtin_t *bi = (builtin_t *)_bi;
@ -60,7 +60,7 @@ builtin_get_key (void *_bi, void *unused)
}
static uintptr_t
builtin_get_hash (void *_bi, void *unused)
builtin_get_hash (const void *_bi, void *unused)
{
builtin_t *bi = (builtin_t *)_bi;
@ -68,7 +68,7 @@ builtin_get_hash (void *_bi, void *unused)
}
static int
builtin_compare (void *_bia, void *_bib, void *unused)
builtin_compare (const void *_bia, const void *_bib, void *unused)
{
builtin_t *bia = (builtin_t *)_bia;
builtin_t *bib = (builtin_t *)_bib;

View file

@ -77,7 +77,7 @@ static char **source_paths;
static const char *
file_get_key (void *_f, void *unused)
file_get_key (const void *_f, void *unused)
{
return ((file_t*)_f)->name;
}

View file

@ -59,7 +59,7 @@ cvar_t *pr_deadbeef_locals;
cvar_t *pr_faultchecks;
static const char *
function_get_key (void *f, void *_pr)
function_get_key (const void *f, void *_pr)
{
progs_t *pr = (progs_t*)_pr;
dfunction_t *func = (dfunction_t*)f;
@ -67,7 +67,7 @@ function_get_key (void *f, void *_pr)
}
static const char *
var_get_key (void *d, void *_pr)
var_get_key (const void *d, void *_pr)
{
progs_t *pr = (progs_t*)_pr;
ddef_t *def = (ddef_t*)d;

View file

@ -1046,13 +1046,13 @@ VISIBLE opcode_t pr_opcodes[] = {
static uintptr_t
opcode_get_hash (void *op, void *unused)
opcode_get_hash (const void *op, void *unused)
{
return ((opcode_t *)op)->opcode;
}
static int
opcode_compare (void *_opa, void *_opb, void *unused)
opcode_compare (const void *_opa, const void *_opb, void *unused)
{
opcode_t *opa = (opcode_t *)_opa;
opcode_t *opb = (opcode_t *)_opb;

View file

@ -45,7 +45,7 @@ struct pr_resource_s {
};
static const char *
resource_get_key (void *r, void *unused)
resource_get_key (const void *r, void *unused)
{
return ((pr_resource_t *)r)->name;
}

View file

@ -161,7 +161,7 @@ string_index (progs_t *pr, strref_t *sr)
}
static const char *
strref_get_key (void *_sr, void *notused)
strref_get_key (const void *_sr, void *notused)
{
strref_t *sr = (strref_t*)_sr;

View file

@ -59,7 +59,7 @@ typedef struct bi_gib_resources_s {
static hashtab_t *bi_gib_builtins;
static const char *
bi_gib_builtin_get_key (void *c, void *unused)
bi_gib_builtin_get_key (const void *c, void *unused)
{
return ((bi_gib_builtin_t *)c)->builtin->name;
}

View file

@ -72,7 +72,7 @@ hashtab_t *gib_builtins;
Hashtable callbacks
*/
static const char *
GIB_Builtin_Get_Key (void *ele, void *ptr)
GIB_Builtin_Get_Key (const void *ele, void *ptr)
{
return ((gib_builtin_t *) ele)->name;
}

View file

@ -369,7 +369,7 @@ typedef struct ObjectHash_s {
} ObjectHash_t;
static const char *
ObjRef_Get_Key (void *ele, void *ptr)
ObjRef_Get_Key (const void *ele, void *ptr)
{
return ((ObjRef_t *) ele)->key;
}

View file

@ -53,7 +53,7 @@ hashtab_t *gib_functions = 0;
Hashtable callbacks
*/
static const char *
GIB_Function_Get_Key (void *ele, void *ptr)
GIB_Function_Get_Key (const void *ele, void *ptr)
{
return ((gib_function_t *) ele)->name;
}

View file

@ -53,7 +53,7 @@ hashtab_t *gib_classes;
Hashtable callbacks
*/
static const char *
GIB_Class_Get_Key (void *ele, void *ptr)
GIB_Class_Get_Key (const void *ele, void *ptr)
{
return ((gib_class_t *) ele)->name;
}
@ -69,7 +69,7 @@ GIB_Class_Free (void *ele, void *ptr)
}
static const char *
GIB_Method_Get_Key (void *ele, void *ptr)
GIB_Method_Get_Key (const void *ele, void *ptr)
{
return ((gib_method_t *) ele)->name;
}
@ -81,7 +81,7 @@ GIB_Method_Free (void *ele, void *ptr)
}
static const char *
GIB_Signal_Get_Key (void *ele, void *ptr)
GIB_Signal_Get_Key (const void *ele, void *ptr)
{
return ((gib_signal_t *) ele)->name;
}

View file

@ -47,7 +47,7 @@ hashtab_t *gib_regexs;
static char errstr[1024];
static const char *
GIB_Regex_Get_Key (void *ele, void *ptr)
GIB_Regex_Get_Key (const void *ele, void *ptr)
{
return ((gib_regex_t *) ele)->regex;
}

View file

@ -105,7 +105,7 @@ GIB_Thread_Init (void)
}
static const char *
GIB_Event_Get_Key (void *ele, void *ptr)
GIB_Event_Get_Key (const void *ele, void *ptr)
{
return ((gib_event_t *) ele)->name;
}

View file

@ -57,7 +57,7 @@ GIB_Var_New (const char *key)
}
static const char *
GIB_Var_Get_Key (void *ele, void *ptr)
GIB_Var_Get_Key (const void *ele, void *ptr)
{
return ((gib_var_t *) ele)->key;
}
@ -270,7 +270,7 @@ GIB_Var_Assign (gib_var_t * var, unsigned int index, dstring_t ** values,
}
static const char *
GIB_Domain_Get_Key (void *ele, void *ptr)
GIB_Domain_Get_Key (const void *ele, void *ptr)
{
return ((gib_domain_t *) ele)->name;
}

View file

@ -558,14 +558,14 @@ swap_bones (byte *bi, byte *bw, int b1, int b2)
}
static uintptr_t
blend_get_hash (void *e, void *unused)
blend_get_hash (const void *e, void *unused)
{
iqmblend_t *b = (iqmblend_t *) e;
return CRC_Block ((byte *) b, sizeof (iqmblend_t));
}
static int
blend_compare (void *e1, void *e2, void *unused)
blend_compare (const void *e1, const void *e2, void *unused)
{
iqmblend_t *b1 = (iqmblend_t *) e1;
iqmblend_t *b2 = (iqmblend_t *) e2;

View file

@ -224,7 +224,7 @@ Skin_SetSkin (skin_t *skin, int cmap, const char *skinname)
}
static const char *
skin_getkey (void *sb, void *unused)
skin_getkey (const void *sb, void *unused)
{
return ((skinbank_t *) sb)->name;
}

View file

@ -60,7 +60,7 @@ typedef struct {
static hashtab_t *bi_cmds;
static const char *
bi_cmd_get_key (void *c, void *unused)
bi_cmd_get_key (const void *c, void *unused)
{
return ((bi_cmd_t *)c)->name;
}

View file

@ -92,7 +92,7 @@ table_index (hash_resources_t *res, bi_hashtab_t *table)
}
static const char *
bi_get_key (void *key, void *_ht)
bi_get_key (const void *key, void *_ht)
{
bi_hashtab_t *ht = (bi_hashtab_t *)_ht;
PR_RESET_PARAMS (ht->pr);
@ -103,7 +103,7 @@ bi_get_key (void *key, void *_ht)
}
static uintptr_t
bi_get_hash (void *key, void *_ht)
bi_get_hash (const void *key, void *_ht)
{
bi_hashtab_t *ht = (bi_hashtab_t *)_ht;
PR_RESET_PARAMS (ht->pr);
@ -114,7 +114,7 @@ bi_get_hash (void *key, void *_ht)
}
static int
bi_compare (void *key1, void *key2, void *_ht)
bi_compare (const void *key1, const void *key2, void *_ht)
{
bi_hashtab_t *ht = (bi_hashtab_t *)_ht;
PR_RESET_PARAMS (ht->pr);
@ -140,7 +140,7 @@ bi_Hash_NewTable (progs_t *pr)
{
hash_resources_t *res = PR_Resources_Find (pr, "Hash");
int tsize = P_INT (pr, 0);
const char *(*gk)(void*,void*);
const char *(*gk)(const void*,void*);
void (*f)(void*,void*);
bi_hashtab_t *ht;
@ -177,8 +177,8 @@ static void
bi_Hash_SetHashCompare (progs_t *pr)
{
bi_hashtab_t *ht = get_table (pr, __FUNCTION__, P_INT (pr, 0));
uintptr_t (*gh)(void*,void*);
int (*cmp)(void*,void*,void*);
uintptr_t (*gh)(const void*,void*);
int (*cmp)(const void*,const void*,void*);
ht->gh = P_FUNCTION (pr, 1);
ht->cmp = P_FUNCTION (pr, 2);

View file

@ -288,26 +288,26 @@ obj_postorder_traverse (progs_t *pr, class_tree *tree, int level,
}
static const char *
selector_get_key (void *s, void *_pr)
selector_get_key (const void *s, void *_pr)
{
progs_t *pr = (progs_t *) _pr;
return PR_GetString (pr, pr->selector_names[(intptr_t) s]);
}
static const char *
class_get_key (void *c, void *pr)
class_get_key (const void *c, void *pr)
{
return PR_GetString ((progs_t *)pr, ((pr_class_t *)c)->name);
}
static uintptr_t
load_methods_get_hash (void *m, void *pr)
load_methods_get_hash (const void *m, void *pr)
{
return (uintptr_t) m;
}
static int
load_methods_compare (void *m1, void *m2, void *pr)
load_methods_compare (const void *m1, const void *m2, void *pr)
{
return m1 == m2;
}

View file

@ -411,14 +411,14 @@ bi_PL_Free (progs_t *pr)
}
static uintptr_t
plist_get_hash (void *key, void *unused)
plist_get_hash (const void *key, void *unused)
{
bi_plist_t *plist = (bi_plist_t *) key;
return (uintptr_t) plist->plitem;
}
static int
plist_compare (void *k1, void *k2, void *unused)
plist_compare (const void *k1, const void *k2, void *unused)
{
bi_plist_t *pl1 = (bi_plist_t *) k1;
bi_plist_t *pl2 = (bi_plist_t *) k2;

View file

@ -294,7 +294,7 @@ cmd_alias_free (void *_a, void *unused)
}
static const char *
cmd_alias_get_key (void *_a, void *unused)
cmd_alias_get_key (const void *_a, void *unused)
{
cmdalias_t *a = (cmdalias_t *) _a;
@ -302,7 +302,7 @@ cmd_alias_get_key (void *_a, void *unused)
}
static const char *
cmd_get_key (void *c, void *unused)
cmd_get_key (const void *c, void *unused)
{
cmd_function_t *cmd = (cmd_function_t *) c;
@ -319,7 +319,7 @@ cmd_provider_free (void *_a, void *unused)
}
static const char *
cmd_provider_get_key (void *_a, void *unused)
cmd_provider_get_key (const void *_a, void *unused)
{
cmd_provider_t *p = (cmd_provider_t *) _a;

View file

@ -556,7 +556,7 @@ cvar_free (void *c, void *unused)
}
static const char *
cvar_get_key (void *c, void *unused)
cvar_get_key (const void *c, void *unused)
{
cvar_t *cvar = (cvar_t*)c;
return cvar->name;
@ -571,7 +571,7 @@ calias_free (void *c, void *unused)
}
static const char *
calias_get_key (void *c, void *unused)
calias_get_key (const void *c, void *unused)
{
cvar_alias_t *calias = (cvar_alias_t *) c;
return calias->name;

View file

@ -56,9 +56,9 @@ struct hashtab_s {
unsigned int size_bits;
size_t num_ele;
void *user_data;
int (*compare)(void*,void*,void*);
uintptr_t (*get_hash)(void*,void*);
const char *(*get_key)(void*,void*);
int (*compare)(const void*,const void*,void*);
uintptr_t (*get_hash)(const void*,void*);
const char *(*get_key)(const void*,void*);
void (*free_ele)(void*,void*);
hashlink_t *tab[1]; // variable size
};
@ -146,13 +146,13 @@ Hash_Buffer (const void *_buf, int len)
}
static uintptr_t
get_hash (void *ele, void *data)
get_hash (const void *ele, void *data)
{
return (uintptr_t)ele;
}
static int
compare (void *a, void *b, void *data)
compare (const void *a, const void *b, void *data)
{
return a == b;
}
@ -182,7 +182,7 @@ get_index (uintptr_t hash, size_t size, size_t bits)
}
VISIBLE hashtab_t *
Hash_NewTable (int tsize, const char *(*gk)(void*,void*),
Hash_NewTable (int tsize, const char *(*gk)(const void*,void*),
void (*f)(void*,void*), void *ud)
{
hashtab_t *tab = calloc (1, field_offset (hashtab_t, tab[tsize]));
@ -204,8 +204,8 @@ Hash_NewTable (int tsize, const char *(*gk)(void*,void*),
}
VISIBLE void
Hash_SetHashCompare (hashtab_t *tab, uintptr_t (*gh)(void*,void*),
int (*cmp)(void*,void*,void*))
Hash_SetHashCompare (hashtab_t *tab, uintptr_t (*gh)(const void*,void*),
int (*cmp)(const void*,const void*,void*))
{
tab->get_hash = gh;
tab->compare = cmp;
@ -291,7 +291,7 @@ Hash_Find (hashtab_t *tab, const char *key)
}
VISIBLE void *
Hash_FindElement (hashtab_t *tab, void *ele)
Hash_FindElement (hashtab_t *tab, const void *ele)
{
unsigned long h = tab->get_hash (ele, tab->user_data);
size_t ind = get_index (h, tab->tab_size, tab->size_bits);

View file

@ -206,7 +206,7 @@ Info_Print (info_t *info)
}
static const char *
info_get_key (void *k, void *unused)
info_get_key (const void *k, void *unused)
{
return ((info_key_t *)k)->key;
}

View file

@ -49,7 +49,7 @@
#include "QF/sys.h"
static const char *
pack_get_key (void *p, void *unused)
pack_get_key (const void *p, void *unused)
{
return ((dpackfile_t *) p)->name;
}

View file

@ -77,13 +77,13 @@ hashtab_t *registered_plugins, *loaded_plugins;
static const char *pi_error = "";
static const char *
plugin_get_key (void *pl, void *unused)
plugin_get_key (const void *pl, void *unused)
{
return ((plugin_list_t *) pl)->name;
}
static const char *
loaded_plugin_get_key (void *lp, void *unusued)
loaded_plugin_get_key (const void *lp, void *unusued)
{
return ((loaded_plugin_t *) lp)->name;
}

View file

@ -119,7 +119,7 @@ static char *PL_ParseUnquotedString (pldata_t *);
static char *PL_ParseData (pldata_t *, int *);
static const char *
dict_get_key (void *i, void *unused)
dict_get_key (const void *i, void *unused)
{
dictkey_t *item = (dictkey_t *) i;
return item->key;

View file

@ -212,7 +212,7 @@ static int num_gamedir_callbacks;
static int max_gamedir_callbacks;
static const char *
qfs_var_get_key (void *_v, void *unused)
qfs_var_get_key (const void *_v, void *unused)
{
return ((qfs_var_t *)_v)->var;
}
@ -402,7 +402,7 @@ qfs_compare (const void *a, const void *b)
}
static const char *
qfs_dir_get_key (void *_k, void *unused)
qfs_dir_get_key (const void *_k, void *unused)
{
return _k;
}

View file

@ -56,7 +56,7 @@
// case insensitive hash and compare
static uintptr_t
wad_get_hash (void *l, void *unused)
wad_get_hash (const void *l, void *unused)
{
char name[17];
int i;
@ -68,7 +68,7 @@ wad_get_hash (void *l, void *unused)
}
static int
wad_compare (void *la, void *lb, void *unused)
wad_compare (const void *la, const void *lb, void *unused)
{
return strncasecmp (((lumpinfo_t *) la)->name,
((lumpinfo_t *) lb)->name, 16) == 0;

View file

@ -153,7 +153,7 @@ new_cachepic (const char *name, qpic_t *pic)
}
static const char *
cachepic_getkey (void *_cp, void *unused)
cachepic_getkey (const void *_cp, void *unused)
{
return ((cachepic_t *) _cp)->name;
}

View file

@ -304,7 +304,7 @@ bi_Draw_Crosshair (progs_t *pr)
}
static const char *
bi_draw_get_key (void *p, void *unused)
bi_draw_get_key (const void *p, void *unused)
{
return ((qpic_res_t *) p)->name;
}

View file

@ -223,7 +223,7 @@ old_keyname_t old_keynames[] = {
hashtab_t *old_key_table;
static const char *
ok_get_key (void *_ok, void *unused)
ok_get_key (const void *_ok, void *unused)
{
old_keyname_t *ok = (old_keyname_t *)_ok;
return ok->old_name;

View file

@ -1193,7 +1193,7 @@ Client_NewConnection (void)
}
static const char *
ucmds_getkey (void *_a, void *unused)
ucmds_getkey (const void *_a, void *unused)
{
ucmd_t *a = (ucmd_t*)_a;
return a->name;

View file

@ -57,7 +57,7 @@ connection_free (void *_c, void *unused)
}
static uintptr_t
connection_get_hash (void *_c, void *unused)
connection_get_hash (const void *_c, void *unused)
{
connection_t *c = (connection_t *) _c;
unsigned long hash;
@ -68,7 +68,7 @@ connection_get_hash (void *_c, void *unused)
}
static int
connection_compare (void *_c1, void *_c2, void *unused)
connection_compare (const void *_c1, const void *_c2, void *unused)
{
connection_t *c1 = (connection_t *) _c1;
connection_t *c2 = (connection_t *) _c2;

View file

@ -64,7 +64,7 @@ static hashtab_t *server_hash;
static server_t *servers;
static const char *
server_get_key (void *sv, void *unused)
server_get_key (const void *sv, void *unused)
{
return ((server_t *) sv)->name;
}

View file

@ -1339,7 +1339,7 @@ call_qc_hook (void *qc_hook)
}
static const char *
ucmds_getkey (void *_a, void *unused)
ucmds_getkey (const void *_a, void *unused)
{
ucmd_t *a = (ucmd_t*)_a;
return a->name;
@ -1366,14 +1366,14 @@ ucmds_free (void *_c, void *unused)
*/
static uintptr_t
ucmd_get_hash (void *_a, void *data)
ucmd_get_hash (const void *_a, void *data)
{
ucmd_t *a = (ucmd_t*)_a;
return Hash_String (a->name);
}
static int
ucmd_compare (void *a, void *b, void *data)
ucmd_compare (const void *a, const void *b, void *data)
{
return a == b;
}

View file

@ -78,7 +78,7 @@ map_error (const char *fmt, ...)
}
static const char *
miptex_getkey (void *key, void *unused)
miptex_getkey (const void *key, void *unused)
{
intptr_t index = (intptr_t) key;
return miptexnames[index - 1];

View file

@ -175,13 +175,13 @@ static struct_def_t object_ivars[] = {
};
static const char *
class_get_key (void *class, void *unused)
class_get_key (const void *class, void *unused)
{
return ((class_t *) class)->name;
}
static const char *
protocol_get_key (void *protocol, void *unused)
protocol_get_key (const void *protocol, void *unused)
{
return ((protocol_t *) protocol)->name;
}
@ -869,14 +869,14 @@ class_message_response (class_t *class, int class_msg, expr_t *sel)
}
static uintptr_t
category_get_hash (void *_c, void *unused)
category_get_hash (const void *_c, void *unused)
{
category_t *c = (category_t *) _c;
return Hash_String (c->name) ^ Hash_String (c->class->name);
}
static int
category_compare (void *_c1, void *_c2, void *unused)
category_compare (const void *_c1, const void *_c2, void *unused)
{
category_t *c1 = (category_t *) _c1;
category_t *c2 = (category_t *) _c2;

View file

@ -68,14 +68,14 @@ static hashtab_t *overloaded_functions;
static hashtab_t *function_map;
static const char *
ol_func_get_key (void *_f, void *unused)
ol_func_get_key (const void *_f, void *unused)
{
overloaded_function_t *f = (overloaded_function_t *) _f;
return f->full_name;
}
static const char *
func_map_get_key (void *_f, void *unused)
func_map_get_key (const void *_f, void *unused)
{
overloaded_function_t *f = (overloaded_function_t *) _f;
return f->name;

View file

@ -73,7 +73,7 @@ static frame_t grab_list[] = {
};
static const char *
frame_get_key (void *f, void *unused)
frame_get_key (const void *f, void *unused)
{
return ((frame_t*)f)->name;
}

View file

@ -206,7 +206,7 @@ get_defref (qfo_def_t *def, qfo_mspace_t *space)
}
static const char *
defs_get_key (void *_r, void *unused)
defs_get_key (const void *_r, void *unused)
{
defref_t *r = (defref_t *)_r;
qfo_def_t *d = REF (r);

View file

@ -64,7 +64,7 @@
static hashtab_t *known_methods;
static const char *
method_get_key (void *meth, void *unused)
method_get_key (const void *meth, void *unused)
{
return ((method_t *) meth)->name;
}
@ -298,7 +298,7 @@ static hashtab_t *sel_index_hash;
static int sel_index;
static uintptr_t
sel_get_hash (void *_sel, void *unused)
sel_get_hash (const void *_sel, void *unused)
{
selector_t *sel = (selector_t *) _sel;
uintptr_t hash;
@ -308,7 +308,7 @@ sel_get_hash (void *_sel, void *unused)
}
static int
sel_compare (void *_s1, void *_s2, void *unused)
sel_compare (const void *_s1, const void *_s2, void *unused)
{
selector_t *s1 = (selector_t *) _s1;
selector_t *s2 = (selector_t *) _s2;
@ -319,14 +319,14 @@ sel_compare (void *_s1, void *_s2, void *unused)
}
static uintptr_t
sel_index_get_hash (void *_sel, void *unused)
sel_index_get_hash (const void *_sel, void *unused)
{
selector_t *sel = (selector_t *) _sel;
return sel->index;
}
static int
sel_index_compare (void *_s1, void *_s2, void *unused)
sel_index_compare (const void *_s1, const void *_s2, void *unused)
{
selector_t *s1 = (selector_t *) _s1;
selector_t *s2 = (selector_t *) _s2;

View file

@ -53,7 +53,7 @@ hashtab_t *opcode_void_table;
#define ROTL(x,n) ((((unsigned)(x))<<(n))|((unsigned)(x))>>(32-n))
static uintptr_t
get_hash (void *_op, void *_tab)
get_hash (const void *_op, void *_tab)
{
opcode_t *op = (opcode_t *) _op;
uintptr_t hash;
@ -64,7 +64,7 @@ get_hash (void *_op, void *_tab)
}
static int
compare (void *_opa, void *_opb, void *unused)
compare (const void *_opa, const void *_opb, void *unused)
{
opcode_t *opa = (opcode_t *) _opa;
opcode_t *opb = (opcode_t *) _opb;
@ -77,7 +77,7 @@ compare (void *_opa, void *_opb, void *unused)
}
static const char *
get_key (void *op, void *unused)
get_key (const void *op, void *unused)
{
return ((opcode_t *) op)->name;
}

View file

@ -326,7 +326,7 @@ static keyword_t keywords[] = {
};
static const char *
keyword_get_key (void *kw, void *unused)
keyword_get_key (const void *kw, void *unused)
{
return ((keyword_t*)kw)->name;
}

View file

@ -204,13 +204,13 @@ free_progs_mem (progs_t *pr, void *mem)
}
static uintptr_t
func_hash (void *func, void *unused)
func_hash (const void *func, void *unused)
{
return ((dfunction_t *) func)->first_statement;
}
static int
func_compare (void *f1, void *f2, void *unused)
func_compare (const void *f1, const void *f2, void *unused)
{
return ((dfunction_t *) f1)->first_statement
== ((dfunction_t *) f2)->first_statement;

View file

@ -230,7 +230,7 @@ static keyword_t keywords[] = {
};
static const char *
keyword_get_key (void *kw, void *unused)
keyword_get_key (const void *kw, void *unused)
{
return ((keyword_t *) kw)->name;
}

View file

@ -50,7 +50,7 @@
static hashtab_t *saved_strings;
static const char *
strpool_get_key (void *_str, void *_strpool)
strpool_get_key (const void *_str, void *_strpool)
{
long str = (long) _str;
strpool_t *strpool = (strpool_t *) _strpool;
@ -121,7 +121,7 @@ strpool_addstr (strpool_t *strpool, const char *str)
}
static const char *
ss_get_key (void *s, void *unused)
ss_get_key (const void *s, void *unused)
{
return (const char *)s;
}

View file

@ -72,7 +72,7 @@ get_value (expr_t *e)
}
static uintptr_t
get_hash (void *_cl, void *unused)
get_hash (const void *_cl, void *unused)
{
case_label_t *cl = (case_label_t *) _cl;
ex_value_t *val;
@ -84,7 +84,7 @@ get_hash (void *_cl, void *unused)
}
static int
compare (void *_cla, void *_clb, void *unused)
compare (const void *_cla, const void *_clb, void *unused)
{
case_label_t *cla = (case_label_t *) _cla;
case_label_t *clb = (case_label_t *) _clb;

View file

@ -68,7 +68,7 @@ new_symbol_type (const char *name, type_t *type)
}
static const char *
sym_getkey (void *k, void *unused)
sym_getkey (const void *k, void *unused)
{
return ((symbol_t *) k)->name;
}

View file

@ -82,7 +82,7 @@ static hashtab_t *quaternion_imm_defs;
static hashtab_t *integer_imm_defs;
static uintptr_t
imm_get_hash (void *_imm, void *_tab)
imm_get_hash (const void *_imm, void *_tab)
{
immediate_t *imm = (immediate_t *) _imm;
hashtab_t **tab = (hashtab_t **) _tab;
@ -113,7 +113,7 @@ imm_get_hash (void *_imm, void *_tab)
}
static int
imm_compare (void *_imm1, void *_imm2, void *_tab)
imm_compare (const void *_imm1, const void *_imm2, void *_tab)
{
immediate_t *imm1 = (immediate_t *) _imm1;
immediate_t *imm2 = (immediate_t *) _imm2;