mesa: skip memmove in optimize_state_parameters if it's no-op
This doesn't change the behavior. Check if there is at least 1 element that follows removed parameters. Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8183>
This commit is contained in:
parent
0c77190b31
commit
2a80595ba5
|
@ -1349,10 +1349,12 @@ _mesa_optimize_state_parameters(struct gl_constants *consts,
|
|||
free((char*)list->Parameters[i].Name);
|
||||
|
||||
/* Remove the merged state vars. */
|
||||
memmove(&list->Parameters[first_param + 1],
|
||||
&list->Parameters[last_param + 1],
|
||||
sizeof(list->Parameters[0]) *
|
||||
(list->NumParameters - last_param - 1));
|
||||
if (last_param + 1 < list->NumParameters) {
|
||||
memmove(&list->Parameters[first_param + 1],
|
||||
&list->Parameters[last_param + 1],
|
||||
sizeof(list->Parameters[0]) *
|
||||
(list->NumParameters - last_param - 1));
|
||||
}
|
||||
list->NumParameters -= param_diff;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue