util/idalloc: hide or remove unused public functions

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11493>
This commit is contained in:
Marek Olšák
2021-05-18 05:11:41 -04:00
committed by Marge Bot
parent 02f37cb9da
commit 730014bd81
2 changed files with 11 additions and 36 deletions

View File

@@ -36,6 +36,17 @@
#include "util/u_math.h"
#include <stdlib.h>
static void
util_idalloc_resize(struct util_idalloc *buf, unsigned new_num_elements)
{
if (new_num_elements > buf->num_elements) {
buf->data = realloc(buf->data, new_num_elements * sizeof(*buf->data));
memset(&buf->data[buf->num_elements], 0,
(new_num_elements - buf->num_elements) * sizeof(*buf->data));
buf->num_elements = new_num_elements;
}
}
void
util_idalloc_init(struct util_idalloc *buf, unsigned initial_num_ids)
{
@@ -51,17 +62,6 @@ util_idalloc_fini(struct util_idalloc *buf)
free(buf->data);
}
void
util_idalloc_resize(struct util_idalloc *buf, unsigned new_num_elements)
{
if (new_num_elements > buf->num_elements) {
buf->data = realloc(buf->data, new_num_elements * sizeof(*buf->data));
memset(&buf->data[buf->num_elements], 0,
(new_num_elements - buf->num_elements) * sizeof(*buf->data));
buf->num_elements = new_num_elements;
}
}
unsigned
util_idalloc_alloc(struct util_idalloc *buf)
{
@@ -130,14 +130,6 @@ util_idalloc_mt_fini(struct util_idalloc_mt *buf)
simple_mtx_destroy(&buf->mutex);
}
void
util_idalloc_mt_resize(struct util_idalloc_mt *buf, unsigned new_num_elements)
{
simple_mtx_lock(&buf->mutex);
util_idalloc_resize(&buf->buf, DIV_ROUND_UP(new_num_elements, 32));
simple_mtx_unlock(&buf->mutex);
}
unsigned
util_idalloc_mt_alloc(struct util_idalloc_mt *buf)
{
@@ -157,11 +149,3 @@ util_idalloc_mt_free(struct util_idalloc_mt *buf, unsigned id)
util_idalloc_free(&buf->buf, id);
simple_mtx_unlock(&buf->mutex);
}
void
util_idalloc_mt_reserve(struct util_idalloc_mt *buf, unsigned id)
{
simple_mtx_lock(&buf->mutex);
util_idalloc_reserve(&buf->buf, id);
simple_mtx_unlock(&buf->mutex);
}

View File

@@ -49,9 +49,6 @@ util_idalloc_init(struct util_idalloc *buf, unsigned initial_num_ids);
void
util_idalloc_fini(struct util_idalloc *buf);
void
util_idalloc_resize(struct util_idalloc *buf, unsigned new_num_elements);
unsigned
util_idalloc_alloc(struct util_idalloc *buf);
@@ -79,18 +76,12 @@ util_idalloc_mt_init_tc(struct util_idalloc_mt *buf);
void
util_idalloc_mt_fini(struct util_idalloc_mt *buf);
void
util_idalloc_mt_resize(struct util_idalloc_mt *buf, unsigned new_num_elements);
unsigned
util_idalloc_mt_alloc(struct util_idalloc_mt *buf);
void
util_idalloc_mt_free(struct util_idalloc_mt *buf, unsigned id);
void
util_idalloc_mt_reserve(struct util_idalloc_mt *buf, unsigned id);
#ifdef __cplusplus
}