projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
radeon/vcn: reset the decode flags from message buffer
[mesa.git]
/
src
/
util
/
slab.c
diff --git
a/src/util/slab.c
b/src/util/slab.c
index 4ce0e9a34852ca08d473c8585a322a71b93fdc5b..62634034fdc6ef0b1994d4d3d0e1233bf4f71b8b 100644
(file)
--- a/
src/util/slab.c
+++ b/
src/util/slab.c
@@
-28,12
+28,10
@@
#include <stdbool.h>
#include <string.h>
#include <stdbool.h>
#include <string.h>
-#define ALIGN(value, align) (((value) + (align) - 1) & ~((align) - 1))
-
#define SLAB_MAGIC_ALLOCATED 0xcafe4321
#define SLAB_MAGIC_FREE 0x7ee01234
#define SLAB_MAGIC_ALLOCATED 0xcafe4321
#define SLAB_MAGIC_FREE 0x7ee01234
-#if
def
DEBUG
+#if
ndef N
DEBUG
#define SET_MAGIC(element, value) (element)->magic = (value)
#define CHECK_MAGIC(element, value) assert((element)->magic == (value))
#else
#define SET_MAGIC(element, value) (element)->magic = (value)
#define CHECK_MAGIC(element, value) assert((element)->magic == (value))
#else
@@
-53,7
+51,7
@@
struct slab_element_header {
*/
intptr_t owner;
*/
intptr_t owner;
-#if
def
DEBUG
+#if
ndef N
DEBUG
intptr_t magic;
#endif
};
intptr_t magic;
#endif
};
@@
-109,8
+107,8
@@
slab_create_parent(struct slab_parent_pool *parent,
unsigned num_items)
{
mtx_init(&parent->mutex, mtx_plain);
unsigned num_items)
{
mtx_init(&parent->mutex, mtx_plain);
- parent->element_size = ALIGN(sizeof(struct slab_element_header) + item_size,
- sizeof(intptr_t));
+ parent->element_size = ALIGN
_POT
(sizeof(struct slab_element_header) + item_size,
+
sizeof(intptr_t));
parent->num_elements = num_items;
}
parent->num_elements = num_items;
}
@@
-282,25
+280,25
@@
void slab_free(struct slab_child_pool *pool, void *ptr)
* Allocate an object from the slab. Single-threaded (no mutex).
*/
void *
* Allocate an object from the slab. Single-threaded (no mutex).
*/
void *
-slab_alloc_st(struct slab_mempool *pool)
+slab_alloc_st(struct slab_mempool *
mem
pool)
{
{
- return slab_alloc(&pool->child);
+ return slab_alloc(&
mem
pool->child);
}
/**
* Free an object allocated from the slab. Single-threaded (no mutex).
*/
void
}
/**
* Free an object allocated from the slab. Single-threaded (no mutex).
*/
void
-slab_free_st(struct slab_mempool *pool, void *ptr)
+slab_free_st(struct slab_mempool *
mem
pool, void *ptr)
{
{
- slab_free(&pool->child, ptr);
+ slab_free(&
mem
pool->child, ptr);
}
void
}
void
-slab_destroy(struct slab_mempool *pool)
+slab_destroy(struct slab_mempool *
mem
pool)
{
{
- slab_destroy_child(&pool->child);
- slab_destroy_parent(&pool->parent);
+ slab_destroy_child(&
mem
pool->child);
+ slab_destroy_parent(&
mem
pool->parent);
}
/**
}
/**
@@
-310,10
+308,10
@@
slab_destroy(struct slab_mempool *pool)
* \param num_items Number of objects to allocate at once.
*/
void
* \param num_items Number of objects to allocate at once.
*/
void
-slab_create(struct slab_mempool *pool,
+slab_create(struct slab_mempool *
mem
pool,
unsigned item_size,
unsigned num_items)
{
unsigned item_size,
unsigned num_items)
{
- slab_create_parent(&pool->parent, item_size, num_items);
- slab_create_child(&
pool->child, &
pool->parent);
+ slab_create_parent(&
mem
pool->parent, item_size, num_items);
+ slab_create_child(&
mempool->child, &mem
pool->parent);
}
}