mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
util: Remove linear_realloc()
Now that linear_realloc() is unused, remove it. It is not an actual realloc, will always allocate new memory and copy data around -- and had a big warning about it in the documentation. In the couple of uses we had before, the client code knew the size, so it could be changed to perform the allocation and the copy by themselves. The client code keeping the size is the recommended way here. This will allow us remove linear_size_chunk later. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25280>
This commit is contained in:
parent
1486742b26
commit
8fc130783b
2 changed files with 0 additions and 27 deletions
|
|
@ -1112,25 +1112,6 @@ ralloc_parent_of_linear_context(linear_ctx *ctx)
|
|||
return PTR_FROM_HEADER(get_header(node)->parent);
|
||||
}
|
||||
|
||||
void *
|
||||
linear_realloc(linear_ctx *ctx, void *old, unsigned new_size)
|
||||
{
|
||||
unsigned old_size = 0;
|
||||
ralloc_header *new_ptr;
|
||||
|
||||
new_ptr = linear_alloc_child(ctx, new_size);
|
||||
|
||||
if (unlikely(!old))
|
||||
return new_ptr;
|
||||
|
||||
old_size = ((linear_size_chunk*)old)[-1].size;
|
||||
|
||||
if (likely(new_ptr && old_size))
|
||||
memcpy(new_ptr, old, MIN2(old_size, new_size));
|
||||
|
||||
return new_ptr;
|
||||
}
|
||||
|
||||
/* All code below is pretty much copied from ralloc and only the alloc
|
||||
* calls are different.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -609,14 +609,6 @@ void ralloc_steal_linear_context(void *new_ralloc_ctx, linear_ctx *ctx);
|
|||
*/
|
||||
void *ralloc_parent_of_linear_context(linear_ctx *ctx);
|
||||
|
||||
/**
|
||||
* Same as realloc except that the linear allocator doesn't free child nodes,
|
||||
* so it's reduced to memory duplication. It's used in places where
|
||||
* reallocation is required. Don't use it often. It's much slower than
|
||||
* realloc.
|
||||
*/
|
||||
void *linear_realloc(linear_ctx *ctx, void *old, unsigned new_size);
|
||||
|
||||
/**
|
||||
* Do a fast allocation of an array from the linear context and initialize it to zero.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue