mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00: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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1606>
This commit is contained in:
@@ -381,8 +381,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;
|
||||
|
||||
@@ -533,8 +533,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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user