mirror of
https://github.com/X11Libre/xf86-input-keyboard.git
synced 2026-03-24 01:14:04 +00:00
Move sizeof to second argument in calloc calls
Clears -Wcalloc-transposed-args warnings from gcc 14.1, such as:
kbd.c: In function ‘KbdPreInit’:
kbd.c:160:32: warning: ‘calloc’ sizes specified with ‘sizeof’ in the
earlier argument and not in the later argument [-Wcalloc-transposed-args]
160 | if (!(pKbd = calloc(sizeof(KbdDevRec), 1))) {
| ^~~~~~~~~
kbd.c:160:32: 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/driver/xf86-input-keyboard/-/merge_requests/14>
This commit is contained in:
@@ -507,7 +507,7 @@ xf86OSKbdPreInit(InputInfoPtr pInfo)
|
||||
|
||||
pKbd->OpenKeyboard = OpenKeyboard;
|
||||
|
||||
pKbd->private = calloc(sizeof(BsdKbdPrivRec), 1);
|
||||
pKbd->private = calloc(1, sizeof(BsdKbdPrivRec));
|
||||
if (pKbd->private == NULL) {
|
||||
xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
|
||||
return FALSE;
|
||||
|
||||
@@ -157,7 +157,7 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
|
||||
xf86CollectInputOptions(pInfo, defaults);
|
||||
xf86ProcessCommonOptions(pInfo, pInfo->options);
|
||||
|
||||
if (!(pKbd = calloc(sizeof(KbdDevRec), 1))) {
|
||||
if (!(pKbd = calloc(1, sizeof(KbdDevRec)))) {
|
||||
rc = BadAlloc;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ xf86OSKbdPreInit(InputInfoPtr pInfo)
|
||||
|
||||
pKbd->OpenKeyboard = OpenKeyboard;
|
||||
|
||||
pKbd->private = calloc(sizeof(sunKbdPrivRec), 1);
|
||||
pKbd->private = calloc(1, sizeof(sunKbdPrivRec));
|
||||
if (pKbd->private == NULL) {
|
||||
xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user