[PATCH xserver] xwayland: fix order of calloc() args

Pekka Paalanen ppaalanen at gmail.com
Wed Nov 23 07:54:27 UTC 2016


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

The definition by the manual is:
	calloc(size_t nmemb, size_t size)

Swap the arguments of calloc() calls to be the right way around.

Presumably this makes no functional difference, but better follow the
spec.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 hw/xwayland/xwayland-input.c  | 6 +++---
 hw/xwayland/xwayland-output.c | 2 +-
 hw/xwayland/xwayland.c        | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 0526122..cc03961 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -847,7 +847,7 @@ touch_handle_down(void *data, struct wl_touch *wl_touch,
     if (surface == NULL)
         return;
 
-    xwl_touch = calloc(sizeof *xwl_touch, 1);
+    xwl_touch = calloc(1, sizeof *xwl_touch);
     if (xwl_touch == NULL) {
         ErrorF("touch_handle_down ENOMEM");
         return;
@@ -1118,7 +1118,7 @@ create_input_device(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version
 {
     struct xwl_seat *xwl_seat;
 
-    xwl_seat = calloc(sizeof *xwl_seat, 1);
+    xwl_seat = calloc(1, sizeof *xwl_seat);
     if (xwl_seat == NULL) {
         ErrorF("create_input ENOMEM\n");
         return;
@@ -1445,7 +1445,7 @@ xwl_pointer_warp_emulator_create(struct xwl_seat *xwl_seat)
 {
     struct xwl_pointer_warp_emulator *warp_emulator;
 
-    warp_emulator = calloc(sizeof *warp_emulator, 1);
+    warp_emulator = calloc(1, sizeof *warp_emulator);
     if (!warp_emulator) {
         ErrorF("%s: ENOMEM", __func__);
         return NULL;
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index ef3b6f6..f3ce763 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -242,7 +242,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id)
     static int serial;
     char name[256];
 
-    xwl_output = calloc(sizeof *xwl_output, 1);
+    xwl_output = calloc(1, sizeof *xwl_output);
     if (xwl_output == NULL) {
         ErrorF("create_output ENOMEM\n");
         return NULL;
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index c277870..9e1ecf8 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -319,7 +319,7 @@ xwl_realize_window(WindowPtr window)
             return ret;
     }
 
-    xwl_window = calloc(sizeof *xwl_window, 1);
+    xwl_window = calloc(1, sizeof *xwl_window);
     if (xwl_window == NULL)
         return FALSE;
 
@@ -688,7 +688,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
     Pixel red_mask, blue_mask, green_mask;
     int ret, bpc, green_bpc, i;
 
-    xwl_screen = calloc(sizeof *xwl_screen, 1);
+    xwl_screen = calloc(1, sizeof *xwl_screen);
     if (xwl_screen == NULL)
         return FALSE;
     xwl_screen->wm_fd = -1;
-- 
2.7.3



More information about the xorg-devel mailing list