[hash] Rename the publicly visible hashlink_t to hashctx_t

I think my biggest problem with the hashlink freelist parameter was how
much implementation it exposed in just the name.
This commit is contained in:
Bill Currie 2022-05-12 17:54:23 +09:00
parent ad8599574a
commit 978d0306c0
33 changed files with 83 additions and 100 deletions

View file

@ -103,7 +103,7 @@ typedef struct exprctx_s {
struct memsuper_s *memsuper;
const struct plitem_s *item;
struct plitem_s *messages;
struct hashlink_s **hashlinks;
struct hashctx_s **hashctx;
int errors;
} exprctx_t;

View file

@ -37,7 +37,7 @@
///@{
typedef struct hashtab_s hashtab_t;
typedef struct hashlink_s hashlink_t;
typedef struct hashctx_s hashctx_t;
typedef int (*hash_select_t) (void *ele, void *data);
typedef void (*hash_action_t) (void *ele, void *data);
@ -53,13 +53,13 @@ typedef void (*hash_action_t) (void *ele, void *data);
element to be freed and the second is the user data pointer.
\param ud user data pointer. set to whatever you want, it will be passed
to the get key and free functions as the second parameter.
\param hlfl Address of opaque pointer used for per-thread allocation of
\param hctx Address of opaque pointer used for per-thread allocation of
internal memory. If null, a local static pointer will be used,
but the hash table will not be thread-safe unless all tables
created with a null \a hlfl (hashlink freelist) are used in
only the one thread. However, this applys only to updating a
hash table; hash tables that are not updated can be safely
shared between threads.
created with a null \a hctx are used in only the one thread.
However, this applys only to updating a hash table; hash
tables that are not updated can be safely shared between
threads.
\return pointer to the hash table (to be passed to the other functions)
or 0 on error.
@ -69,8 +69,7 @@ typedef void (*hash_action_t) (void *ele, void *data);
previous ones until the later one is removed (Hash_Del).
*/
hashtab_t *Hash_NewTable (int tsize, const char *(*gk)(const void*,void*),
void (*f)(void*,void*), void *ud,
hashlink_t **hlfl);
void (*f)(void*,void*), void *ud, hashctx_t **hctx);
/** change the hash and compare functions used by the Hash_*Element functions.
the default hash function just returns the address of the element, and the

View file

@ -28,7 +28,7 @@
#ifndef __QF_plist_h
#define __QF_plist_h
struct hashlink_s;
struct hashctx_s;
/** \defgroup plist Property lists
\ingroup utils
@ -127,14 +127,14 @@ typedef struct plelement_s {
/** Create an in-memory representation of the contents of a property list.
\param string the saved plist, as read from a file.
\param hashlinks Hashlink chain to use when creating dictionaries (see
\param hashctx Hashlink chain to use when creating dictionaries (see
Hash_NewTable()). May be null.
\return Returns an object equivalent to the passed-in string.
\note You are responsible for freeing the returned object.
*/
plitem_t *PL_GetPropertyList (const char *string,
struct hashlink_s **hashlinks);
struct hashctx_s **hashctx);
/** Create a property list string from the in-memory representation.
@ -308,11 +308,11 @@ plitem_t *PL_RemoveObjectAtIndex (plitem_t *array, int index);
/** Create a new dictionary object.
The dictionary will be empty.
\param hashlinks Hashlink chain to use when creating dictionaries (see
\param hashctx Hashlink chain to use when creating dictionaries (see
Hash_NewTable()). May be null.
\return the new dictionary object
*/
plitem_t *PL_NewDictionary (struct hashlink_s **hashlinks);
plitem_t *PL_NewDictionary (struct hashctx_s **hashctx);
/** Create a new array object.
The array will be empty.

View file

@ -337,7 +337,7 @@ void ED_PrintNum (progs_t *pr, pr_int_t ent, const char *fieldname);
// pr_parse.c
struct script_s;
struct plitem_s;
struct hashlink_s;
struct hashctx_s;
qboolean ED_ParseEpair (progs_t *pr, pr_type_t *base, pr_def_t *key,
const char *s);
struct plitem_s *ED_EntityDict (progs_t *pr, edict_t *ed);
@ -345,7 +345,7 @@ struct plitem_s *ED_GlobalsDict (progs_t *pr);
void ED_InitGlobals (progs_t *pr, struct plitem_s *globals);
void ED_InitEntity (progs_t *pr, struct plitem_s *entity, edict_t *ent);
struct plitem_s *ED_ConvertToPlist (struct script_s *script, int nohack,
struct hashlink_s **hashlinks);
struct hashctx_s **hashctx);
struct plitem_s *ED_Parse (progs_t *pr, const char *data);
void ED_LoadFromFile (progs_t *pr, const char *data);
void ED_EntityParseFunction (progs_t *pr, void *data);
@ -2006,7 +2006,7 @@ struct progs_s {
int null_bad;
int no_exec_limit;
struct hashlink_s **hashlink_freelist;
struct hashctx_s **hashctx;
void (*file_error) (progs_t *pr, const char *path);
void *(*load_file) (progs_t *pr, const char *path, off_t *size);
void *(*allocate_progs_mem) (progs_t *pr, int size);

View file

@ -48,7 +48,7 @@ typedef struct vulkan_ctx_s {
struct qfv_device_s *device;
struct qfv_swapchain_s *swapchain;
VkSampleCountFlagBits msaaSamples; // FIXME not here?
struct hashlink_s *hashlinks; //FIXME want per thread
struct hashctx_s *hashctx; //FIXME want per thread
VkSurfaceKHR surface; //FIXME surface = window, so "contains" swapchain
struct plitem_s *pipelineDef;

View file

@ -456,7 +456,6 @@ CL_Legacy_Init (void)
OK_Init ();
Cmd_AddCommand ("bind", cl_bind_f, "compatibility wrapper for in_bind");
Cmd_AddCommand ("unbind", cl_unbind_f, "compatibility wrapper for in_bind");
// FIXME hashlinks
IN_LoadConfig (PL_GetPropertyList (default_input_config, 0));
}

View file

@ -111,9 +111,8 @@ PR_RegisterBuiltins (progs_t *pr, builtin_t *builtins, void *data)
pr->builtin_blocks = malloc (sizeof (biblock_t));
DARRAY_INIT (pr->builtin_blocks, 16);
pr->builtin_hash = Hash_NewTable (1021, builtin_get_key, 0, pr,
pr->hashlink_freelist);
pr->builtin_num_hash = Hash_NewTable (1021, 0, 0, pr,
pr->hashlink_freelist);
pr->hashctx);
pr->builtin_num_hash = Hash_NewTable (1021, 0, 0, pr, pr->hashctx);
Hash_SetHashCompare (pr->builtin_num_hash, builtin_get_hash,
builtin_compare);

View file

@ -1948,11 +1948,9 @@ PR_Debug_Init (progs_t *pr)
res->type_encodings[i] = &res->void_type;
}
res->file_hash = Hash_NewTable (509, file_get_key, file_free, 0,
pr->hashlink_freelist);
res->debug_syms = Hash_NewTable (509, def_get_key, 0, pr,
pr->hashlink_freelist);
res->compunits = Hash_NewTable (509, compunit_get_key, 0, pr,
pr->hashlink_freelist);
pr->hashctx);
res->debug_syms = Hash_NewTable (509, def_get_key, 0, pr, pr->hashctx);
res->compunits = Hash_NewTable (509, compunit_get_key, 0, pr, pr->hashctx);
PR_Resources_Register (pr, "PR_Debug", res, pr_debug_clear);
pr->pr_debug_resources = res;

View file

@ -544,13 +544,10 @@ PR_Init (progs_t *pr)
PR_Strings_Init (pr);
PR_Debug_Init (pr);
pr->function_hash = Hash_NewTable (1021, function_get_key, 0, pr,
pr->hashlink_freelist);
pr->global_hash = Hash_NewTable (1021, var_get_key, 0, pr,
pr->hashlink_freelist);
pr->field_hash = Hash_NewTable (1021, var_get_key, 0, pr,
pr->hashlink_freelist);
pr->type_hash = Hash_NewTable (1021, type_get_key, 0, pr,
pr->hashlink_freelist);
pr->hashctx);
pr->global_hash = Hash_NewTable (1021, var_get_key, 0, pr, pr->hashctx);
pr->field_hash = Hash_NewTable (1021, var_get_key, 0, pr, pr->hashctx);
pr->type_hash = Hash_NewTable (1021, type_get_key, 0, pr, pr->hashctx);
}
VISIBLE void

View file

@ -109,7 +109,7 @@ VISIBLE plitem_t *
ED_EntityDict (progs_t *pr, edict_t *ed)
{
dstring_t *dstr = dstring_newstr ();
plitem_t *entity = PL_NewDictionary (pr->hashlink_freelist);
plitem_t *entity = PL_NewDictionary (pr->hashctx);
pr_uint_t i;
int j;
int type;
@ -155,7 +155,7 @@ VISIBLE plitem_t *
ED_GlobalsDict (progs_t *pr)
{
dstring_t *dstr = dstring_newstr ();
plitem_t *globals = PL_NewDictionary (pr->hashlink_freelist);
plitem_t *globals = PL_NewDictionary (pr->hashctx);
pr_uint_t i;
const char *name;
const char *value;
@ -290,7 +290,7 @@ ED_ParseEpair (progs_t *pr, pr_type_t *base, pr_def_t *key, const char *s)
*/
VISIBLE plitem_t *
ED_ConvertToPlist (script_t *script, int nohack, struct hashlink_s **hashlinks)
ED_ConvertToPlist (script_t *script, int nohack, struct hashctx_s **hashctx)
{
dstring_t *dstr = dstring_newstr ();
plitem_t *plist = PL_NewArray ();
@ -307,7 +307,7 @@ ED_ConvertToPlist (script_t *script, int nohack, struct hashlink_s **hashlinks)
msg = "EOF without closing brace";
goto parse_error;
}
ent = PL_NewDictionary (hashlinks);
ent = PL_NewDictionary (hashctx);
while (1) {
int n;
@ -513,11 +513,11 @@ ED_Parse (progs_t *pr, const char *data)
if (Script_GetToken (script, 1)) {
if (strequal (script->token->str, "(")) {
// new style (plist) entity data
entity_list = PL_GetPropertyList (data, pr->hashlink_freelist);
entity_list = PL_GetPropertyList (data, pr->hashctx);
} else {
// old style entity data
Script_UngetToken (script);
entity_list = ED_ConvertToPlist (script, 0, pr->hashlink_freelist);
entity_list = ED_ConvertToPlist (script, 0, pr->hashctx);
}
}
Script_Delete (script);

View file

@ -54,7 +54,7 @@ VISIBLE void
PR_Resources_Init (progs_t *pr)
{
pr->resource_hash = Hash_NewTable (1021, resource_get_key, 0, 0,
pr->hashlink_freelist);
pr->hashctx);
pr->resources = 0;
}

View file

@ -265,7 +265,7 @@ PR_LoadStrings (progs_t *pr)
Hash_FlushTable (res->strref_hash);
} else {
res->strref_hash = Hash_NewTable (1021, strref_get_key, strref_free,
res, pr->hashlink_freelist);
res, pr->hashctx);
res->string_map = 0;
res->free_string_refs = 0;
res->dyn_str_size = 0;

View file

@ -195,8 +195,7 @@ GIB_Progs_Init (progs_t *pr)
res->builtins = 0;
bi_gib_builtins = Hash_NewTable (1021, bi_gib_builtin_get_key,
bi_gib_builtin_free, 0,
pr->hashlink_freelist);
bi_gib_builtin_free, 0, pr->hashctx);
PR_Resources_Register (pr, "GIB", res, bi_gib_builtin_clear);
PR_RegisterBuiltins (pr, builtins, res);

View file

@ -794,7 +794,7 @@ IN_Binding_SaveConfig (plitem_t *config)
plitem_t *devices = PL_NewArray ();
PL_D_AddObject (config, "devices", devices);
for (in_devbindings_t *db = devbindings_list; db; db = db->next) {
plitem_t *db_cfg = PL_NewDictionary (0); //FIXME hashlinks
plitem_t *db_cfg = PL_NewDictionary (0);
PL_A_AddObject (devices, db_cfg);
PL_D_AddObject (db_cfg, "name", PL_NewString (db->name));
PL_D_AddObject (db_cfg, "devname", PL_NewString (db->devname));

View file

@ -508,7 +508,7 @@ IN_ProcessEvents (void)
void
IN_SaveConfig (plitem_t *config)
{
plitem_t *input_config = PL_NewDictionary (0); //FIXME hashlinks
plitem_t *input_config = PL_NewDictionary (0);
PL_D_AddObject (config, "input", input_config);
IMT_SaveConfig (input_config);

View file

@ -947,14 +947,14 @@ IMT_SaveConfig (plitem_t *config)
PL_D_AddObject (config, "contexts", ctx_list);
for (size_t i = 0; i < in_contexts.size; i++) {
in_context_t *context = &in_contexts.a[i];
plitem_t *ctx = PL_NewDictionary (0); //FIXME hashlinks
plitem_t *ctx = PL_NewDictionary (0);
PL_A_AddObject (ctx_list, ctx);
PL_D_AddObject (ctx, "name", PL_NewString (context->name));
if (context->imts) {
plitem_t *imt_list = PL_NewArray ();
PL_D_AddObject (ctx, "imts", imt_list);
for (imt_t *imt = context->imts; imt; imt = imt->next) {
plitem_t *imt_cfg = PL_NewDictionary (0); //FIXME hashlinks
plitem_t *imt_cfg = PL_NewDictionary (0);
PL_D_AddObject (imt_cfg, "name", PL_NewString (imt->name));
if (imt->chain) {
PL_D_AddObject (imt_cfg, "chain",
@ -976,7 +976,6 @@ IMT_SaveConfig (plitem_t *config)
PL_D_AddObject (ctx, "switchers", switcher_list);
for (imt_switcher_t *switcher = context->switchers; switcher;
switcher = switcher->next) {
//FIXME hashlinks
plitem_t *switcher_cfg = PL_NewDictionary (0);
PL_A_AddObject (switcher_list, switcher_cfg);
@ -1020,7 +1019,7 @@ IMT_SaveAxisConfig (plitem_t *axes, int axis_ind, int dev_axis)
in_axisbinding_t *a = imt->axis_bindings.a[axis_ind];
if (a) {
in_recipe_t *recipe = a->recipe;
plitem_t *axis = PL_NewDictionary (0); //FIXME hashlinks
plitem_t *axis = PL_NewDictionary (0);
PL_A_AddObject (axes, axis);
PL_D_AddObject (axis, "imt", PL_NewString (imt->name));
@ -1054,7 +1053,7 @@ IMT_SaveButtonConfig (plitem_t *buttons, int button_ind, int dev_button)
for (imt_t *imt = context->imts; imt; imt = imt->next) {
in_buttonbinding_t *b = imt->button_bindings.a[button_ind];
if (b) {
plitem_t *button = PL_NewDictionary (0); //FIXME hashlinks
plitem_t *button = PL_NewDictionary (0);
PL_A_AddObject (buttons, button);
PL_D_AddObject (button, "imt", PL_NewString (imt->name));

View file

@ -164,7 +164,7 @@ RUA_Cmd_Init (progs_t *pr, int secure)
if (!bi_cmds)
bi_cmds = Hash_NewTable (1021, bi_cmd_get_key, bi_cmd_free, 0,
pr->hashlink_freelist);
pr->hashctx);
PR_Resources_Register (pr, "Cmd", res, bi_cmd_clear);
PR_RegisterBuiltins (pr, builtins, res);

View file

@ -173,7 +173,7 @@ bi_Hash_NewTable (progs_t *pr, void *_res)
gk = ht->gk ? bi_get_key : 0;
f = ht->f ? bi_free : 0;
ht->tab = Hash_NewTable (tsize, gk, f, ht, pr->hashlink_freelist);
ht->tab = Hash_NewTable (tsize, gk, f, ht, pr->hashctx);
R_INT (pr) = table_index (res, ht);
}

View file

@ -51,7 +51,7 @@ typedef struct rua_in_cookie_s {
} rua_in_cookie_t;
typedef struct input_resources_s {
hashlink_t *hash_links;
hashctx_t *hashctx;
hashtab_t *cookies;
memsuper_t *cookie_super;
} input_resources_t;
@ -510,7 +510,7 @@ RUA_Input_Init (progs_t *pr, int secure)
res->cookie_super = new_memsuper ();
res->cookies = Hash_NewTable (251, 0, rua_in_free_cookie, res,
&res->hash_links);
&res->hashctx);
Hash_SetHashCompare (res->cookies, rua_in_hash_cookie, rua_in_cmp_cookies);
PR_Resources_Register (pr, "input", res, bi_input_clear);

View file

@ -2309,13 +2309,11 @@ RUA_Obj_Init (progs_t *pr, int secure)
probj->pr = pr;
probj->selector_hash = Hash_NewTable (1021, selector_get_key, 0, probj,
pr->hashlink_freelist);
probj->classes = Hash_NewTable (1021, class_get_key, 0, probj,
pr->hashlink_freelist);
pr->hashctx);
probj->classes = Hash_NewTable (1021, class_get_key, 0, probj, pr->hashctx);
probj->protocols = Hash_NewTable (1021, protocol_get_key, 0, probj,
pr->hashlink_freelist);
probj->load_methods = Hash_NewTable (1021, 0, 0, probj,
pr->hashlink_freelist);
pr->hashctx);
probj->load_methods = Hash_NewTable (1021, 0, 0, probj, pr->hashctx);
probj->msg = dstring_newstr();
Hash_SetHashCompare (probj->load_methods, load_methods_get_hash,
load_methods_compare);

View file

@ -194,7 +194,7 @@ bi_PL_GetFromFile (progs_t *pr, void *_res)
Qread (file, buf, len);
buf[len] = 0;
plitem = PL_GetPropertyList (buf, pr->hashlink_freelist);
plitem = PL_GetPropertyList (buf, pr->hashctx);
R_INT (pr) = plist_retain (res, plitem);
}
@ -203,8 +203,7 @@ static void
bi_PL_GetPropertyList (progs_t *pr, void *_res)
{
plist_resources_t *res = _res;
plitem_t *plitem = PL_GetPropertyList (P_GSTRING (pr, 0),
pr->hashlink_freelist);
plitem_t *plitem = PL_GetPropertyList (P_GSTRING (pr, 0), pr->hashctx);
R_INT (pr) = plist_retain (res, plitem);
}
@ -382,7 +381,7 @@ static void
bi_PL_NewDictionary (progs_t *pr, void *_res)
{
plist_resources_t *res = _res;
plitem_t *plitem = PL_NewDictionary (pr->hashlink_freelist);
plitem_t *plitem = PL_NewDictionary (pr->hashctx);
R_INT (pr) = plist_retain (res, plitem);
}
@ -484,7 +483,7 @@ void
RUA_Plist_Init (progs_t *pr, int secure)
{
plist_resources_t *res = calloc (1, sizeof (plist_resources_t));
res->plist_tab = Hash_NewTable (1021, 0, 0, 0, pr->hashlink_freelist);
res->plist_tab = Hash_NewTable (1021, 0, 0, 0, pr->hashctx);
Hash_SetHashCompare (res->plist_tab, plist_get_hash, plist_compare);
PR_Resources_Register (pr, "plist", res, bi_plist_clear);

View file

@ -161,7 +161,7 @@ cexpr_init_symtab (exprtab_t *symtab, exprctx_t *ctx)
{
exprsym_t *sym;
symtab->tab = Hash_NewTable (61, expr_getkey, 0, 0, ctx->hashlinks);
symtab->tab = Hash_NewTable (61, expr_getkey, 0, 0, ctx->hashctx);
for (sym = symtab->symbols; sym->name; sym++) {
Hash_Add (symtab->tab, sym);
}

View file

@ -489,7 +489,7 @@ cvar_write_config (void *ele, void *data)
VISIBLE void
Cvar_SaveConfig (plitem_t *config)
{
plitem_t *cvars = PL_NewDictionary (0); //FIXME hashlinks
plitem_t *cvars = PL_NewDictionary (0);
PL_D_AddObject (config, "cvars", cvars);
Hash_ForEach (cvar_hash, cvar_write_config, cvars);
Hash_ForEach (user_cvar_hash, cvar_write_config, cvars);

View file

@ -45,11 +45,11 @@
#include "compat.h"
struct hashlink_s {
typedef struct hashlink_s {
struct hashlink_s *next;
struct hashlink_s **prev;
void *data;
};
} hashlink_t;
struct hashtab_s {
size_t tab_size;
@ -184,8 +184,7 @@ get_index (uintptr_t hash, size_t size, size_t bits)
VISIBLE hashtab_t *
Hash_NewTable (int tsize, const char *(*gk)(const void*,void*),
void (*f)(void*,void*), void *ud,
hashlink_t **hashlink_freelist)
void (*f)(void*,void*), void *ud, hashctx_t **hctx)
{
hashtab_t *tab = calloc (1, field_offset (hashtab_t, tab[tsize]));
if (!tab)
@ -194,10 +193,10 @@ Hash_NewTable (int tsize, const char *(*gk)(const void*,void*),
tab->user_data = ud;
tab->get_key = gk;
tab->free_ele = f;
if (!hashlink_freelist) {
hashlink_freelist = &default_hashlink_freelist;
if (!hctx) {
hctx = (hashctx_t **) &default_hashlink_freelist;
}
tab->hashlink_freelist = hashlink_freelist;
tab->hashlink_freelist = (hashlink_t **) hctx;
while (tsize) {
tab->size_bits++;

View file

@ -98,7 +98,7 @@ typedef struct pldata_s { // Unparsed property list string
unsigned line_start;
plitem_t *error;
va_ctx_t *va_ctx;
hashlink_t **hashlinks;
hashctx_t **hashctx;
} pldata_t;
// Ugly defines for fast checking and conversion from char to number
@ -165,11 +165,11 @@ pl_newitem (pltype_t type)
}
VISIBLE plitem_t *
PL_NewDictionary (hashlink_t **hashlinks)
PL_NewDictionary (hashctx_t **hashctx)
{
plitem_t *item = pl_newitem (QFDictionary);
pldict_t *dict = malloc (sizeof (pldict_t));
dict->tab = Hash_NewTable (1021, dict_get_key, dict_free, NULL, hashlinks);
dict->tab = Hash_NewTable (1021, dict_get_key, dict_free, NULL, hashctx);
DARRAY_INIT (&dict->keys, 8);
item->data = dict;
return item;
@ -776,7 +776,7 @@ pl_parsepropertylistitem (pldata_t *pl)
switch (pl->ptr[pl->pos]) {
case '{':
{
item = PL_NewDictionary (pl->hashlinks);
item = PL_NewDictionary (pl->hashctx);
item->line = pl->line;
pl->pos++;
@ -934,7 +934,7 @@ pl_parsepropertylistitem (pldata_t *pl)
}
VISIBLE plitem_t *
PL_GetPropertyList (const char *string, hashlink_t **hashlinks)
PL_GetPropertyList (const char *string, hashctx_t **hashctx)
{
plitem_t *newpl = NULL;
@ -946,7 +946,7 @@ PL_GetPropertyList (const char *string, hashlink_t **hashlinks)
.end = strlen (string),
.line = 1,
.va_ctx = va_create_context (4),
.hashlinks = hashlinks,
.hashctx = hashctx,
};
if (!(newpl = pl_parsepropertylistitem (&pl))) {

View file

@ -352,8 +352,7 @@ void
R_Progs_Init (progs_t *pr)
{
draw_resources_t *res = calloc (1, sizeof (draw_resources_t));
res->pic_hash = Hash_NewTable (61, bi_draw_get_key, 0, 0,
pr->hashlink_freelist);
res->pic_hash = Hash_NewTable (61, bi_draw_get_key, 0, 0, pr->hashctx);
PR_Resources_Register (pr, "Draw", res, bi_draw_clear);
PR_RegisterBuiltins (pr, builtins, res);

View file

@ -961,8 +961,7 @@ static plfield_t renderpass_fields[] = {
static hashtab_t *
handlref_symtab (void (*free_func)(void*,void*), vulkan_ctx_t *ctx)
{
return Hash_NewTable (23, handleref_getkey, free_func,
ctx, &ctx->hashlinks);
return Hash_NewTable (23, handleref_getkey, free_func, ctx, &ctx->hashctx);
}
static const char *
@ -978,7 +977,7 @@ static exprtab_t root_symtab = {
static void __attribute__((constructor))
root_symtab_init (void)
{
// using a null hashlinks here is safe because this function is run before
// using a null hashctx here is safe because this function is run before
// main and thus before any possibility of threading.
exprctx_t root_context = { .symtab = &root_symtab };
cexpr_init_symtab (&root_symtab, &root_context);
@ -988,9 +987,8 @@ void
QFV_InitParse (vulkan_ctx_t *ctx)
{
exprctx_t context = {};
enum_symtab = Hash_NewTable (61, enum_symtab_getkey, 0, 0,
&ctx->hashlinks);
context.hashlinks = &ctx->hashlinks;
enum_symtab = Hash_NewTable (61, enum_symtab_getkey, 0, 0, &ctx->hashctx);
context.hashctx = &ctx->hashctx;
vkgen_init_symtabs (&context);
cexpr_init_symtab (&qfv_output_t_symtab, &context);
cexpr_init_symtab (&vulkan_frameset_t_symtab, &context);
@ -1034,7 +1032,7 @@ parse_object (vulkan_ctx_t *ctx, memsuper_t *memsuper, plitem_t *plist,
exprctx.external_variables = &vars_tab;
exprctx.messages = messages;
exprctx.hashlinks = &ctx->hashlinks;
exprctx.hashctx = &ctx->hashctx;
exprctx.memsuper = memsuper;
cexpr_init_symtab (&vars_tab, &exprctx);

View file

@ -301,7 +301,7 @@ build_configs (vulkan_ctx_t *ctx)
builtin_plists = malloc (num_plists * sizeof (plitem_t *));
num_plists = 0;
for (exprsym_t *sym = builtin_plist_syms; sym->name; sym++) {
plitem_t *item = PL_GetPropertyList (sym->value, &ctx->hashlinks);
plitem_t *item = PL_GetPropertyList (sym->value, &ctx->hashctx);
if (!item) {
// Syntax errors in the compiled-in plists are unrecoverable
Sys_Error ("Error parsing plist for %s", sym->name);
@ -311,7 +311,7 @@ build_configs (vulkan_ctx_t *ctx)
sym->type = &cexpr_plitem;
num_plists++;
}
exprctx_t ectx = { .hashlinks = &ctx->hashlinks };
exprctx_t ectx = { .hashctx = &ctx->hashctx };
cexpr_init_symtab (&builtin_configs, &ectx);
}
@ -328,7 +328,7 @@ get_builtin_config (vulkan_ctx_t *ctx, const char *name)
.result = &result,
.symtab = &builtin_configs,
.memsuper = new_memsuper (),
.hashlinks = &ctx->hashlinks,
.hashctx = &ctx->hashctx,
.messages = PL_NewArray (),
};
if (cexpr_eval_string (name, &ectx)) {

View file

@ -172,7 +172,7 @@ CL_WriteConfiguration (void)
// dedicated servers initialize the host but don't parse and set the
// config.cfg cvars
if (host_initialized && !isDedicated && cl_writecfg) {
plitem_t *config = PL_NewDictionary (0); //FIXME hashlinks
plitem_t *config = PL_NewDictionary (0);
Cvar_SaveConfig (config);
IN_SaveConfig (config);
@ -204,7 +204,7 @@ CL_ReadConfiguration (const char *cfg_name)
cfg[len] = 0;
Qclose (cfg_file);
plitem_t *config = PL_GetPropertyList (cfg, 0); // FIXME hashlinks
plitem_t *config = PL_GetPropertyList (cfg, 0);
if (!config) {
return 0;
}

View file

@ -1730,7 +1730,7 @@ void
Host_WriteConfiguration (void)
{
if (host_initialized && cl_writecfg) {
plitem_t *config = PL_NewDictionary (0); //FIXME hashlinks
plitem_t *config = PL_NewDictionary (0);
Cvar_SaveConfig (config);
IN_SaveConfig (config);
@ -1762,7 +1762,7 @@ Host_ReadConfiguration (const char *cfg_name)
cfg[len] = 0;
Qclose (cfg_file);
plitem_t *config = PL_GetPropertyList (cfg, 0); // FIXME hashlinks
plitem_t *config = PL_GetPropertyList (cfg, 0);
if (!config) {
return 0;
}

View file

@ -207,7 +207,7 @@ create_progs (qwaq_thread_t *thread)
pr->allocate_progs_mem = allocate_progs_mem;
pr->free_progs_mem = free_progs_mem;
pr->no_exec_limit = 1;
pr->hashlink_freelist = &thread->hashlink_freelist;
pr->hashctx = &thread->hashctx;
pr_debug = 2;
pr_boundscheck = 0;

View file

@ -587,7 +587,7 @@ qwaq_input_init (qwaq_input_resources_t *res)
Hash_FlushTable (res->key_sequences);
} else {
res->key_sequences = Hash_NewTable (127, key_sequence_getkey, 0, 0,
res->pr->hashlink_freelist);
res->pr->hashctx);
}
for (size_t i = 0; i < sizeof (default_keys) / sizeof (default_keys[0]);
i++) {

View file

@ -18,7 +18,7 @@ typedef struct qwaq_thread_s {
progs_t *pr;
int rua_security;
struct memhunk_s *hunk;
struct hashlink_s *hashlink_freelist;
struct hashctx_s *hashctx;
pr_func_t main_func;
void *data;
} qwaq_thread_t;