mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-04 02:50:14 +01:00
Move sizeof to second argument in calloc calls
Clears -Wcalloc-transposed-args warnings from gcc 14.1, such as:
../dix/main.c:165:42: warning: ‘calloc’ sizes specified with ‘sizeof’ in the
earlier argument and not in the later argument [-Wcalloc-transposed-args]
165 | serverClient = calloc(sizeof(ClientRec), 1);
| ^~~~~~~~~
../dix/main.c:165:42: note: earlier argument should specify number of
elements, later size of each element
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 522f469fe9)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
This commit is contained in:
parent
c0bd91f49e
commit
ca52da8cba
9 changed files with 14 additions and 14 deletions
|
|
@ -350,7 +350,7 @@ ProcXListInputDevices(ClientPtr client)
|
|||
};
|
||||
|
||||
/* allocate space for saving skip value */
|
||||
skip = calloc(sizeof(Bool), inputInfo.numDevices);
|
||||
skip = calloc(inputInfo.numDevices, sizeof(Bool));
|
||||
if (!skip)
|
||||
return BadAlloc;
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ ProcXIQueryDevice(ClientPtr client)
|
|||
len += SizeDeviceInfo(dev);
|
||||
}
|
||||
else {
|
||||
skip = calloc(sizeof(Bool), inputInfo.numDevices);
|
||||
skip = calloc(inputInfo.numDevices, sizeof(Bool));
|
||||
if (!skip)
|
||||
return BadAlloc;
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors,
|
|||
return ((ExtensionEntry *) NULL);
|
||||
}
|
||||
|
||||
ext = calloc(sizeof(ExtensionEntry), 1);
|
||||
ext = calloc(1, sizeof(ExtensionEntry));
|
||||
if (!ext)
|
||||
return NULL;
|
||||
if (!dixAllocatePrivates(&ext->devPrivates, PRIVATE_EXTENSION)) {
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ dix_main(int argc, char *argv[], char *envp[])
|
|||
CreateWellKnownSockets();
|
||||
for (i = 1; i < LimitClients; i++)
|
||||
clients[i] = NullClient;
|
||||
serverClient = calloc(sizeof(ClientRec), 1);
|
||||
serverClient = calloc(1, sizeof(ClientRec));
|
||||
if (!serverClient)
|
||||
FatalError("couldn't create server client");
|
||||
InitClient(serverClient, 0, (void *) NULL);
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ dixRegisterScreenPrivateKey(DevScreenPrivateKey screenKey, ScreenPtr pScreen,
|
|||
assert(key->type == type);
|
||||
return TRUE;
|
||||
}
|
||||
key = calloc(sizeof(DevPrivateKeyRec), 1);
|
||||
key = calloc(1, sizeof(DevPrivateKeyRec));
|
||||
if (!key)
|
||||
return FALSE;
|
||||
if (!dixRegisterPrivateKey(key, type, size)) {
|
||||
|
|
|
|||
|
|
@ -1089,7 +1089,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
|
|||
Bool force_es = FALSE;
|
||||
const char *glvnd_vendor = NULL;
|
||||
|
||||
glamor_egl = calloc(sizeof(*glamor_egl), 1);
|
||||
glamor_egl = calloc(1, sizeof(*glamor_egl));
|
||||
if (glamor_egl == NULL)
|
||||
return FALSE;
|
||||
if (xf86GlamorEGLPrivateIndex == -1)
|
||||
|
|
|
|||
|
|
@ -1850,7 +1850,7 @@ xwl_glamor_init_gbm(struct xwl_screen *xwl_screen)
|
|||
if (!dixRegisterPrivateKey(&xwl_gbm_private_key, PRIVATE_SCREEN, 0))
|
||||
return FALSE;
|
||||
|
||||
xwl_gbm = calloc(sizeof(*xwl_gbm), 1);
|
||||
xwl_gbm = calloc(1, sizeof(*xwl_gbm));
|
||||
if (!xwl_gbm) {
|
||||
ErrorF("glamor: Not enough memory to setup GBM, disabling\n");
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -2870,7 +2870,7 @@ tablet_seat_handle_add_tablet(void *data, struct zwp_tablet_seat_v2 *tablet_seat
|
|||
struct xwl_seat *xwl_seat = data;
|
||||
struct xwl_tablet *xwl_tablet;
|
||||
|
||||
xwl_tablet = calloc(sizeof *xwl_tablet, 1);
|
||||
xwl_tablet = calloc(1, sizeof *xwl_tablet);
|
||||
if (xwl_tablet == NULL) {
|
||||
ErrorF("%s ENOMEM\n", __func__);
|
||||
return;
|
||||
|
|
@ -2901,7 +2901,7 @@ tablet_seat_handle_add_tool(void *data, struct zwp_tablet_seat_v2 *tablet_seat,
|
|||
struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
|
||||
struct xwl_tablet_tool *xwl_tablet_tool;
|
||||
|
||||
xwl_tablet_tool = calloc(sizeof *xwl_tablet_tool, 1);
|
||||
xwl_tablet_tool = calloc(1, sizeof *xwl_tablet_tool);
|
||||
if (xwl_tablet_tool == NULL) {
|
||||
ErrorF("%s ENOMEM\n", __func__);
|
||||
return;
|
||||
|
|
@ -2924,7 +2924,7 @@ tablet_seat_handle_add_pad(void *data, struct zwp_tablet_seat_v2 *tablet_seat,
|
|||
struct xwl_seat *xwl_seat = data;
|
||||
struct xwl_tablet_pad *xwl_tablet_pad;
|
||||
|
||||
xwl_tablet_pad = calloc(sizeof *xwl_tablet_pad, 1);
|
||||
xwl_tablet_pad = calloc(1, sizeof *xwl_tablet_pad);
|
||||
if (xwl_tablet_pad == NULL) {
|
||||
ErrorF("%s ENOMEM\n", __func__);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -379,8 +379,8 @@ ProcXFixesGetCursorImage(ClientPtr client)
|
|||
width = pCursor->bits->width;
|
||||
height = pCursor->bits->height;
|
||||
npixels = width * height;
|
||||
rep = calloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32),
|
||||
1);
|
||||
rep = calloc(1,
|
||||
sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32));
|
||||
if (!rep)
|
||||
return BadAlloc;
|
||||
|
||||
|
|
@ -531,8 +531,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
|
|||
name = pCursor->name ? NameForAtom(pCursor->name) : "";
|
||||
nbytes = strlen(name);
|
||||
nbytesRound = pad_to_int32(nbytes);
|
||||
rep = calloc(sizeof(xXFixesGetCursorImageAndNameReply) +
|
||||
npixels * sizeof(CARD32) + nbytesRound, 1);
|
||||
rep = calloc(1, sizeof(xXFixesGetCursorImageAndNameReply) +
|
||||
npixels * sizeof(CARD32) + nbytesRound);
|
||||
if (!rep)
|
||||
return BadAlloc;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue