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:
@@ -36,6 +36,17 @@
|
|||||||
#include "util/u_math.h"
|
#include "util/u_math.h"
|
||||||
#include <stdlib.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
|
void
|
||||||
util_idalloc_init(struct util_idalloc *buf, unsigned initial_num_ids)
|
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);
|
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
|
unsigned
|
||||||
util_idalloc_alloc(struct util_idalloc *buf)
|
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);
|
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
|
unsigned
|
||||||
util_idalloc_mt_alloc(struct util_idalloc_mt *buf)
|
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);
|
util_idalloc_free(&buf->buf, id);
|
||||||
simple_mtx_unlock(&buf->mutex);
|
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);
|
|
||||||
}
|
|
||||||
|
@@ -49,9 +49,6 @@ util_idalloc_init(struct util_idalloc *buf, unsigned initial_num_ids);
|
|||||||
void
|
void
|
||||||
util_idalloc_fini(struct util_idalloc *buf);
|
util_idalloc_fini(struct util_idalloc *buf);
|
||||||
|
|
||||||
void
|
|
||||||
util_idalloc_resize(struct util_idalloc *buf, unsigned new_num_elements);
|
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
util_idalloc_alloc(struct util_idalloc *buf);
|
util_idalloc_alloc(struct util_idalloc *buf);
|
||||||
|
|
||||||
@@ -79,18 +76,12 @@ util_idalloc_mt_init_tc(struct util_idalloc_mt *buf);
|
|||||||
void
|
void
|
||||||
util_idalloc_mt_fini(struct util_idalloc_mt *buf);
|
util_idalloc_mt_fini(struct util_idalloc_mt *buf);
|
||||||
|
|
||||||
void
|
|
||||||
util_idalloc_mt_resize(struct util_idalloc_mt *buf, unsigned new_num_elements);
|
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
util_idalloc_mt_alloc(struct util_idalloc_mt *buf);
|
util_idalloc_mt_alloc(struct util_idalloc_mt *buf);
|
||||||
|
|
||||||
void
|
void
|
||||||
util_idalloc_mt_free(struct util_idalloc_mt *buf, unsigned id);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user