aboutsummaryrefslogtreecommitdiffstats
path: root/src/connection.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-12-06 11:22:16 -0600
committerDaniel Stone <daniels@collabora.com>2017-12-27 13:49:51 +0000
commit9a2735c2b74d63e7495268e3c9595912d00314c8 (patch)
treea4bc197ded9329a71d26b4bde0326d498725219e /src/connection.c
parentdoc: start documenting Xwayland (diff)
downloadwayland-9a2735c2b74d63e7495268e3c9595912d00314c8.tar
wayland-9a2735c2b74d63e7495268e3c9595912d00314c8.tar.gz
wayland-9a2735c2b74d63e7495268e3c9595912d00314c8.tar.bz2
wayland-9a2735c2b74d63e7495268e3c9595912d00314c8.tar.lz
wayland-9a2735c2b74d63e7495268e3c9595912d00314c8.tar.xz
wayland-9a2735c2b74d63e7495268e3c9595912d00314c8.tar.zst
wayland-9a2735c2b74d63e7495268e3c9595912d00314c8.zip
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>
Diffstat (limited to 'src/connection.c')
-rw-r--r--src/connection.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/connection.c b/src/connection.c
index e60ad75..d029914 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -632,7 +632,7 @@ wl_connection_demarshal(struct wl_connection *connection,
const char *signature;
struct argument_details arg;
struct wl_closure *closure;
- struct wl_array *array, *array_extra;
+ struct wl_array *array_extra;
count = arg_count_for_signature(message->signature);
if (count > WL_CLOSURE_MAX_ARGS) {
@@ -643,7 +643,8 @@ wl_connection_demarshal(struct wl_connection *connection,
}
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) {
errno = ENOMEM;
wl_connection_consume(connection, size);