util/hash_table: set _mesa_hash_table_init return type to void
it always returns true because it no longer allocates anything Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
This commit is contained in:
@@ -4617,10 +4617,11 @@ nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *sinfo, const s
|
||||
ctx.glsl_types[1] = _mesa_pointer_hash_table_create(ctx.mem_ctx);
|
||||
ctx.bo_array_types = _mesa_pointer_hash_table_create(ctx.mem_ctx);
|
||||
ctx.bo_struct_types = _mesa_pointer_hash_table_create(ctx.mem_ctx);
|
||||
if (!ctx.glsl_types[0] || !ctx.glsl_types[1] || !ctx.bo_array_types || !ctx.bo_struct_types ||
|
||||
!_mesa_hash_table_init(&ctx.image_types, ctx.mem_ctx, _mesa_hash_pointer, _mesa_key_pointer_equal))
|
||||
if (!ctx.glsl_types[0] || !ctx.glsl_types[1] || !ctx.bo_array_types || !ctx.bo_struct_types)
|
||||
goto fail;
|
||||
|
||||
_mesa_hash_table_init(&ctx.image_types, ctx.mem_ctx, _mesa_hash_pointer, _mesa_key_pointer_equal);
|
||||
|
||||
spirv_builder_emit_cap(&ctx.builder, SpvCapabilityShader);
|
||||
|
||||
switch (s->info.stage) {
|
||||
|
||||
@@ -1669,8 +1669,7 @@ bool
|
||||
zink_descriptor_layouts_init(struct zink_screen *screen)
|
||||
{
|
||||
for (unsigned i = 0; i < ZINK_DESCRIPTOR_BASE_TYPES; i++) {
|
||||
if (!_mesa_hash_table_init(&screen->desc_set_layouts[i], screen, hash_descriptor_layout, equals_descriptor_layout))
|
||||
return false;
|
||||
_mesa_hash_table_init(&screen->desc_set_layouts[i], screen, hash_descriptor_layout, equals_descriptor_layout);
|
||||
_mesa_set_init(&screen->desc_pool_keys[i], screen, hash_descriptor_pool_key, equals_descriptor_pool_key);
|
||||
}
|
||||
simple_mtx_init(&screen->desc_set_layouts_lock, mtx_plain);
|
||||
|
||||
@@ -160,7 +160,7 @@ entry_is_present(const struct hash_table *ht, struct hash_entry *entry)
|
||||
return entry->key != NULL && entry->key != ht->deleted_key;
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_hash_table_init(struct hash_table *ht,
|
||||
void *mem_ctx,
|
||||
uint32_t (*key_hash_function)(const void *key),
|
||||
@@ -182,8 +182,6 @@ _mesa_hash_table_init(struct hash_table *ht,
|
||||
ht->entries = 0;
|
||||
ht->deleted_entries = 0;
|
||||
ht->deleted_key = &deleted_key_value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* It's preferred to use _mesa_hash_table_init instead of this to skip ralloc. */
|
||||
@@ -202,11 +200,7 @@ _mesa_hash_table_create(void *mem_ctx,
|
||||
if (ht == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!_mesa_hash_table_init(ht, ht, key_hash_function, key_equals_function)) {
|
||||
ralloc_free(ht);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_mesa_hash_table_init(ht, ht, key_hash_function, key_equals_function);
|
||||
return ht;
|
||||
}
|
||||
|
||||
@@ -231,10 +225,10 @@ _mesa_hash_table_create_u32_keys(void *mem_ctx)
|
||||
return _mesa_hash_table_create(mem_ctx, key_u32_hash, key_u32_equals);
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_hash_table_init_u32_keys(struct hash_table *ht, void *mem_ctx)
|
||||
{
|
||||
return _mesa_hash_table_init(ht, mem_ctx, key_u32_hash, key_u32_equals);
|
||||
_mesa_hash_table_init(ht, mem_ctx, key_u32_hash, key_u32_equals);
|
||||
}
|
||||
|
||||
struct hash_table *
|
||||
@@ -807,11 +801,11 @@ _mesa_pointer_hash_table_create(void *mem_ctx)
|
||||
_mesa_key_pointer_equal);
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_pointer_hash_table_init(struct hash_table *ht, void *mem_ctx)
|
||||
{
|
||||
return _mesa_hash_table_init(ht, mem_ctx, _mesa_hash_pointer,
|
||||
_mesa_key_pointer_equal);
|
||||
_mesa_hash_table_init(ht, mem_ctx, _mesa_hash_pointer,
|
||||
_mesa_key_pointer_equal);
|
||||
}
|
||||
|
||||
/* It's preferred to use _mesa_string_hash_table_init instead of this to skip ralloc. */
|
||||
@@ -822,11 +816,11 @@ _mesa_string_hash_table_create(void *mem_ctx)
|
||||
_mesa_key_string_equal);
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_string_hash_table_init(struct hash_table *ht, void *mem_ctx)
|
||||
{
|
||||
return _mesa_hash_table_init(ht, mem_ctx, _mesa_hash_string,
|
||||
_mesa_key_string_equal);
|
||||
_mesa_hash_table_init(ht, mem_ctx, _mesa_hash_string,
|
||||
_mesa_key_string_equal);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -74,7 +74,7 @@ _mesa_hash_table_create(void *mem_ctx,
|
||||
bool (*key_equals_function)(const void *a,
|
||||
const void *b));
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_hash_table_init(struct hash_table *ht,
|
||||
void *mem_ctx,
|
||||
uint32_t (*key_hash_function)(const void *key),
|
||||
@@ -88,7 +88,7 @@ _mesa_hash_table_fini(struct hash_table *ht,
|
||||
struct hash_table *
|
||||
_mesa_hash_table_create_u32_keys(void *mem_ctx);
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_hash_table_init_u32_keys(struct hash_table *ht, void *mem_ctx);
|
||||
|
||||
struct hash_table *
|
||||
@@ -149,13 +149,13 @@ bool _mesa_key_pointer_equal(const void *a, const void *b);
|
||||
struct hash_table *
|
||||
_mesa_pointer_hash_table_create(void *mem_ctx);
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_pointer_hash_table_init(struct hash_table *ht, void *mem_ctx);
|
||||
|
||||
struct hash_table *
|
||||
_mesa_string_hash_table_create(void *mem_ctx);
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_string_hash_table_init(struct hash_table *ht, void *mem_ctx);
|
||||
|
||||
bool
|
||||
@@ -210,9 +210,9 @@ hash_table_call_foreach(struct hash_table *ht,
|
||||
return _mesa_hash_table_create(memctx, T##_hash, T##_equal); \
|
||||
} \
|
||||
\
|
||||
static UNUSED inline bool T##_table_init(struct hash_table *ht, void *memctx) \
|
||||
static UNUSED inline void T##_table_init(struct hash_table *ht, void *memctx) \
|
||||
{ \
|
||||
return _mesa_hash_table_init(ht, memctx, T##_hash, T##_equal); \
|
||||
_mesa_hash_table_init(ht, memctx, T##_hash, T##_equal); \
|
||||
} \
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user