mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2025-04-14 03:40:30 +00:00
mesa: use alloca in search_resource_hash
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13507>
This commit is contained in:
parent
1776d741c5
commit
c216f1931d
@ -568,7 +568,7 @@ search_resource_hash(struct gl_shader_program *shProg,
|
|||||||
|
|
||||||
/* If dealing with array, we need to get the basename. */
|
/* If dealing with array, we need to get the basename. */
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
name_copy = (char *) malloc(base_name_end - name + 1);
|
name_copy = (char *) alloca(base_name_end - name + 1);
|
||||||
memcpy(name_copy, name, base_name_end - name);
|
memcpy(name_copy, name, base_name_end - name);
|
||||||
name_copy[base_name_end - name] = '\0';
|
name_copy[base_name_end - name] = '\0';
|
||||||
len = base_name_end - name;
|
len = base_name_end - name;
|
||||||
@ -580,9 +580,6 @@ search_resource_hash(struct gl_shader_program *shProg,
|
|||||||
struct gl_program_resource *res = (struct gl_program_resource *)
|
struct gl_program_resource *res = (struct gl_program_resource *)
|
||||||
_mesa_hash_table_u64_search(shProg->data->ProgramResourceHash, key);
|
_mesa_hash_table_u64_search(shProg->data->ProgramResourceHash, key);
|
||||||
|
|
||||||
if (name_copy != name)
|
|
||||||
free(name_copy);
|
|
||||||
|
|
||||||
if (res && array_index)
|
if (res && array_index)
|
||||||
*array_index = index >= 0 ? index : 0;
|
*array_index = index >= 0 ? index : 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user