projects
/
platform
/
upstream
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
155b1b1
)
util/idalloc: resize if ID is too large for reservation
author
Marek Olšák
<marek.olsak@amd.com>
Wed, 30 Sep 2020 17:44:52 +0000
(13:44 -0400)
committer
Marge Bot
<eric+marge@anholt.net>
Tue, 6 Oct 2020 15:59:07 +0000
(15:59 +0000)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7031>
src/util/u_idalloc.c
patch
|
blob
|
history
diff --git
a/src/util/u_idalloc.c
b/src/util/u_idalloc.c
index
b5d886d
..
9255faa
100644
(file)
--- a/
src/util/u_idalloc.c
+++ b/
src/util/u_idalloc.c
@@
-103,7
+103,8
@@
util_idalloc_free(struct util_idalloc *buf, unsigned id)
void
util_idalloc_reserve(struct util_idalloc *buf, unsigned id)
{
- assert(id < buf->num_elements);
+ if (id >= buf->num_elements)
+ util_idalloc_resize(buf, id * 2);
assert((buf->data[id / 32] & (1u << (id % 32))) == 0);
buf->data[id / 32] |= 1u << (id % 32);
}