mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-05-01 06:46:41 -04:00
connection: Don't declare a local variable just to takes its size
We can sizeof the struct type instead of declaring a pointer and taking the size of what it points to. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
147617800d
commit
9a2735c2b7
1 changed files with 3 additions and 2 deletions
|
|
@ -632,7 +632,7 @@ wl_connection_demarshal(struct wl_connection *connection,
|
||||||
const char *signature;
|
const char *signature;
|
||||||
struct argument_details arg;
|
struct argument_details arg;
|
||||||
struct wl_closure *closure;
|
struct wl_closure *closure;
|
||||||
struct wl_array *array, *array_extra;
|
struct wl_array *array_extra;
|
||||||
|
|
||||||
count = arg_count_for_signature(message->signature);
|
count = arg_count_for_signature(message->signature);
|
||||||
if (count > WL_CLOSURE_MAX_ARGS) {
|
if (count > WL_CLOSURE_MAX_ARGS) {
|
||||||
|
|
@ -643,7 +643,8 @@ wl_connection_demarshal(struct wl_connection *connection,
|
||||||
}
|
}
|
||||||
|
|
||||||
num_arrays = wl_message_count_arrays(message);
|
num_arrays = wl_message_count_arrays(message);
|
||||||
closure = malloc(sizeof *closure + size + num_arrays * sizeof *array);
|
closure = malloc(sizeof *closure + size +
|
||||||
|
num_arrays * sizeof(struct wl_array));
|
||||||
if (closure == NULL) {
|
if (closure == NULL) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
wl_connection_consume(connection, size);
|
wl_connection_consume(connection, size);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue