summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-07-14 14:05:34 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-07-14 14:05:34 -0700
commit5253278119a4db07b5a01856f0de34e576f4dcdd (patch)
treec68ae51f483e44f849c24bd50e2729db533f8dbc
parent2fb618706c2d9159ae340cdf045ecced5dd7092a (diff)
Move sizeof to second argument in calloc callsHEADmaster
Clears -Wcalloc-transposed-args warnings from gcc 14.1, such as: tdfx_dri.c: In function ‘TDFXDRIScreenInit’: tdfx_dri.c:173:46: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 173 | if (!(pTDFXDRI = (TDFXDRIPtr)calloc(sizeof(TDFXDRIRec),1))) { | ^~~~~~~~~~ tdfx_dri.c:173:46: 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-video-tdfx/-/merge_requests/10>
-rw-r--r--src/tdfx_dri.c2
-rw-r--r--src/tdfx_driver.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/tdfx_dri.c b/src/tdfx_dri.c
index 13b3c52..8097f00 100644
--- a/src/tdfx_dri.c
+++ b/src/tdfx_dri.c
@@ -170,7 +170,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
}
pDRIInfo->SAREASize = SAREA_MAX;
- if (!(pTDFXDRI = (TDFXDRIPtr)calloc(sizeof(TDFXDRIRec),1))) {
+ if (!(pTDFXDRI = (TDFXDRIPtr)calloc(1, sizeof(TDFXDRIRec)))) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[dri] DRI memory allocation failed, disabling DRI.\n");
DRIDestroyInfoRec(pTDFX->pDRIInfo);
diff --git a/src/tdfx_driver.c b/src/tdfx_driver.c
index 2ace46a..3f0b146 100644
--- a/src/tdfx_driver.c
+++ b/src/tdfx_driver.c
@@ -288,7 +288,7 @@ static TDFXPtr
TDFXGetRec(ScrnInfoPtr pScrn)
{
if (pScrn->driverPrivate == NULL) {
- pScrn->driverPrivate = XNFcallocarray(sizeof(TDFXRec), 1);
+ pScrn->driverPrivate = XNFcallocarray(1, sizeof(TDFXRec));
}
return (TDFXPtr) pScrn->driverPrivate;
@@ -1047,7 +1047,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
}
#endif
}
- clockRanges = XNFcallocarray(sizeof(ClockRange), 1);
+ clockRanges = XNFcallocarray(1, sizeof(ClockRange));
clockRanges->next=NULL;
clockRanges->minClock= 12000; /* !!! What's the min clock? !!! */
clockRanges->maxClock=pTDFX->MaxClock;