diff --git a/Xi/listdev.c b/Xi/listdev.c index 5a8cd65c8..c8076a62d 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -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; diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c index c33a251a2..cd9bb39d5 100644 --- a/Xi/xiquerydevice.c +++ b/Xi/xiquerydevice.c @@ -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; diff --git a/config/hal.c b/config/hal.c index 7e0e88498..8289956eb 100644 --- a/config/hal.c +++ b/config/hal.c @@ -102,7 +102,7 @@ get_prop_string_array(LibHalContext * hal_ctx, const char *udi, for (i = 0; props[i]; i++) len += strlen(props[i]); - ret = calloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */ + ret = calloc(len + i, sizeof(char)); /* i - 1 commas, 1 NULL */ if (!ret) { libhal_free_string_array(props); return NULL; diff --git a/dix/extension.c b/dix/extension.c index e8a373de3..d67cd52dd 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -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)) { diff --git a/dix/main.c b/dix/main.c index 58fd6b3d2..7f76e6eab 100644 --- a/dix/main.c +++ b/dix/main.c @@ -162,7 +162,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); diff --git a/dix/privates.c b/dix/privates.c index 01686637c..ffa77347b 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -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)) { diff --git a/exa/exa.c b/exa/exa.c index 42047fa2d..8a61a58e3 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -883,7 +883,7 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo) return FALSE; } - pExaScr = calloc(sizeof(ExaScreenPrivRec), 1); + pExaScr = calloc(1, sizeof(ExaScreenPrivRec)); if (!pExaScr) { LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n", pScreen->myNum); diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 844dbbe71..86455c407 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -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) diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 3d0dd872b..12fbdc0b0 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -1265,7 +1265,7 @@ static Status MouseInit(KdPointerInfo * pi) { pi->driverPrivate = (EphyrPointerPrivate *) - calloc(sizeof(EphyrPointerPrivate), 1); + calloc(1, sizeof(EphyrPointerPrivate)); ((EphyrPointerPrivate *) pi->driverPrivate)->enabled = FALSE; pi->nAxes = 3; pi->nButtons = 32; @@ -1326,7 +1326,7 @@ EphyrKeyboardInit(KdKeyboardInfo * ki) XkbControlsRec controls; ki->driverPrivate = (EphyrKbdPrivate *) - calloc(sizeof(EphyrKbdPrivate), 1); + calloc(1, sizeof(EphyrKbdPrivate)); if (hostx_load_keymap(&keySyms, modmap, &controls)) { XkbApplyMappingChange(ki->dixdev, &keySyms, diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 92776cba8..e59efed4b 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -677,7 +677,7 @@ KdRemoveKeyboardDriver(KdKeyboardDriver * driver) KdKeyboardInfo * KdNewKeyboard(void) { - KdKeyboardInfo *ki = calloc(sizeof(KdKeyboardInfo), 1); + KdKeyboardInfo *ki = calloc(1, sizeof(KdKeyboardInfo)); if (!ki) return NULL; @@ -708,7 +708,7 @@ KdAddConfigKeyboard(char *keyboard) if (!keyboard) return Success; - new = (struct KdConfigDevice *) calloc(sizeof(struct KdConfigDevice), 1); + new = (struct KdConfigDevice *) calloc(1, sizeof(struct KdConfigDevice)); if (!new) return BadAlloc; @@ -772,7 +772,7 @@ KdAddConfigPointer(char *pointer) if (!pointer) return Success; - new = (struct KdConfigDevice *) calloc(sizeof(struct KdConfigDevice), 1); + new = (struct KdConfigDevice *) calloc(1, sizeof(struct KdConfigDevice)); if (!new) return BadAlloc; diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index d61072ab8..c7935f071 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -544,7 +544,7 @@ addInputHandler(int fd, InputHandlerProc proc, void *data) if (fd < 0 || !proc) return NULL; - ih = calloc(sizeof(*ih), 1); + ih = calloc(1, sizeof(*ih)); if (!ih) return NULL; diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 34fece99d..43c775717 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -172,7 +172,7 @@ xf86AllocateScreen(DriverPtr drv, int flags) i = xf86NumGPUScreens++; xf86GPUScreens = xnfreallocarray(xf86GPUScreens, xf86NumGPUScreens, sizeof(ScrnInfoPtr)); - xf86GPUScreens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1); + xf86GPUScreens[i] = xnfcalloc(1, sizeof(ScrnInfoRec)); pScrn = xf86GPUScreens[i]; pScrn->scrnIndex = i + GPU_SCREEN_OFFSET; /* Changes when a screen is removed */ pScrn->is_gpu = TRUE; @@ -183,14 +183,14 @@ xf86AllocateScreen(DriverPtr drv, int flags) i = xf86NumScreens++; xf86Screens = xnfreallocarray(xf86Screens, xf86NumScreens, sizeof(ScrnInfoPtr)); - xf86Screens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1); + xf86Screens[i] = xnfcalloc(1, sizeof(ScrnInfoRec)); pScrn = xf86Screens[i]; pScrn->scrnIndex = i; /* Changes when a screen is removed */ } pScrn->origIndex = pScrn->scrnIndex; /* This never changes */ - pScrn->privates = xnfcalloc(sizeof(DevUnion), xf86ScrnInfoPrivateCount); + pScrn->privates = xnfcalloc(xf86ScrnInfoPrivateCount, sizeof(DevUnion)); /* * EnableDisableFBAccess now gets initialized in InitOutput() * pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess; diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 081a3dc11..92215b28f 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -769,7 +769,7 @@ xf86AllocateInput(void) { InputInfoPtr pInfo; - pInfo = calloc(sizeof(*pInfo), 1); + pInfo = calloc(1, sizeof(*pInfo)); if (!pInfo) return NULL; diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c index 119211dc5..eeee3ebfd 100644 --- a/hw/xfree86/common/xf86sbusBus.c +++ b/hw/xfree86/common/xf86sbusBus.c @@ -70,7 +70,7 @@ CheckSbusDevice(const char *device, int fbNum) xf86SbusInfo = xnfreallocarray(xf86SbusInfo, ++xf86nSbusInfo + 1, sizeof(psdp)); xf86SbusInfo[xf86nSbusInfo] = NULL; - xf86SbusInfo[xf86nSbusInfo - 1] = psdp = xnfcalloc(sizeof(sbusDevice), 1); + xf86SbusInfo[xf86nSbusInfo - 1] = psdp = xnfcalloc(1, sizeof(sbusDevice)); psdp->devId = sbusDeviceTable[i].devId; psdp->fbNum = fbNum; psdp->device = xnfstrdup(device); diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c index 7259d2192..5be559b07 100644 --- a/hw/xfree86/ddc/interpret_edid.c +++ b/hw/xfree86/ddc/interpret_edid.c @@ -171,7 +171,7 @@ xf86InterpretEDID(int scrnIndex, Uchar * block) if (!block) return NULL; - if (!(m = xnfcalloc(sizeof(xf86Monitor), 1))) + if (!(m = xnfcalloc(1, sizeof(xf86Monitor)))) return NULL; m->scrnIndex = scrnIndex; m->rawData = block; diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml index b7da50de3..bf1bdc271 100644 --- a/hw/xfree86/doc/ddxDesign.xml +++ b/hw/xfree86/doc/ddxDesign.xml @@ -7837,7 +7837,7 @@ ZZZGetRec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate != NULL) return TRUE; - pScrn->driverPrivate = xnfcalloc(sizeof(ZZZRec), 1); + pScrn->driverPrivate = xnfcalloc(1, sizeof(ZZZRec)); /* Initialise as required */ ... return TRUE; diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index ea2ac7d21..dad212791 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -258,7 +258,7 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn, tmp.resOwner = NULL; if (!pDRIEntPriv) - pDRIEntPriv = xnfcalloc(sizeof(*pDRIEntPriv), 1); + pDRIEntPriv = xnfcalloc(1, sizeof(*pDRIEntPriv)); if (!pDRIEntPriv) { DRIDrvMsg(-1, X_INFO, "[drm] Failed to allocate memory for " @@ -1209,7 +1209,7 @@ DRIDriverClipNotify(ScreenPtr pScreen) DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv->pDriverInfo->ClipNotify) { - WindowPtr *pDRIWindows = calloc(sizeof(WindowPtr), pDRIPriv->nrWindows); + WindowPtr *pDRIWindows = calloc(pDRIPriv->nrWindows, sizeof(WindowPtr)); DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; if (pDRIPriv->nrWindows > 0) { diff --git a/hw/xfree86/drivers/inputtest/xf86-input-inputtest.c b/hw/xfree86/drivers/inputtest/xf86-input-inputtest.c index dd19f47a9..76ba62e44 100644 --- a/hw/xfree86/drivers/inputtest/xf86-input-inputtest.c +++ b/hw/xfree86/drivers/inputtest/xf86-input-inputtest.c @@ -940,7 +940,7 @@ get_type_name(InputInfoPtr pInfo, xf86ITDevicePtr driver_data) static xf86ITDevicePtr device_alloc(void) { - xf86ITDevicePtr driver_data = calloc(sizeof(xf86ITDevice), 1); + xf86ITDevicePtr driver_data = calloc(1, sizeof(xf86ITDevice)); if (!driver_data) return NULL; diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index f3400a1cd..8741ffe5e 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -396,7 +396,7 @@ ms_setup_entity(ScrnInfoPtr scrn, int entity_num) xf86SetEntityInstanceForScreen(scrn, entity_num, xf86GetNumEntityInstances(entity_num) - 1); if (!pPriv->ptr) - pPriv->ptr = xnfcalloc(sizeof(modesettingEntRec), 1); + pPriv->ptr = xnfcalloc(1, sizeof(modesettingEntRec)); } #ifdef XSERVER_LIBPCIACCESS @@ -515,7 +515,7 @@ GetRec(ScrnInfoPtr pScrn) if (pScrn->driverPrivate) return TRUE; - pScrn->driverPrivate = xnfcalloc(sizeof(modesettingRec), 1); + pScrn->driverPrivate = xnfcalloc(1, sizeof(modesettingRec)); return TRUE; } diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 505960737..56ab5ee9d 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -536,7 +536,7 @@ drm_mode_ensure_blob(xf86CrtcPtr crtc, const drmModeModeInfo* mode_info) drmmode_CompareKModes(&drmmode_crtc->current_mode->mode_info, mode_info) == 0) return 0; - mode = calloc(sizeof(drmmode_mode_rec), 1); + mode = calloc(1, sizeof(drmmode_mode_rec)); if (!mode) return -1; @@ -904,7 +904,7 @@ drmmode_crtc_set_mode(xf86CrtcPtr crtc, Bool test_only) return ret; } - output_ids = calloc(sizeof(uint32_t), xf86_config->num_output); + output_ids = calloc(xf86_config->num_output, sizeof(uint32_t)); if (!output_ids) return -1; @@ -2495,8 +2495,8 @@ drmmode_crtc_create_planes(xf86CrtcPtr crtc, int num) drmmode_crtc->plane_id = best_plane; if (best_kplane) { drmmode_crtc->num_formats = best_kplane->count_formats; - drmmode_crtc->formats = calloc(sizeof(drmmode_format_rec), - best_kplane->count_formats); + drmmode_crtc->formats = calloc(best_kplane->count_formats, + sizeof(drmmode_format_rec)); if (!populate_format_modifiers(crtc, best_kplane, blob_id)) { for (i = 0; i < best_kplane->count_formats; i++) drmmode_crtc->formats[i].format = best_kplane->formats[i]; @@ -2573,7 +2573,7 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res crtc = xf86CrtcCreate(pScrn, &drmmode_crtc_funcs); if (crtc == NULL) return 0; - drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1); + drmmode_crtc = xnfcalloc(1, sizeof(drmmode_crtc_private_rec)); crtc->driver_private = drmmode_crtc; drmmode_crtc->mode_crtc = drmModeGetCrtc(drmmode->fd, mode_res->crtcs[num]); @@ -3442,7 +3442,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r } } - kencoders = calloc(sizeof(drmModeEncoderPtr), koutput->count_encoders); + kencoders = calloc(koutput->count_encoders, sizeof(drmModeEncoderPtr)); if (!kencoders) { goto out_free_encoders; } @@ -3471,7 +3471,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r goto out_free_encoders; } - drmmode_output = calloc(sizeof(drmmode_output_private_rec), 1); + drmmode_output = calloc(1, sizeof(drmmode_output_private_rec)); if (!drmmode_output) { xf86OutputDestroy(output); goto out_free_encoders; diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c index 788b500d6..412fb5713 100644 --- a/hw/xfree86/drivers/modesetting/present.c +++ b/hw/xfree86/drivers/modesetting/present.c @@ -127,7 +127,7 @@ ms_present_queue_vblank(RRCrtcPtr crtc, struct ms_present_vblank_event *event; uint32_t seq; - event = calloc(sizeof(struct ms_present_vblank_event), 1); + event = calloc(1, sizeof(struct ms_present_vblank_event)); if (!event) return BadAlloc; event->event_id = event_id; diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index 76bc4809f..885f5e96e 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -94,7 +94,7 @@ fbdevHWGetRec(ScrnInfoPtr pScrn) if (FBDEVHWPTR(pScrn) != NULL) return TRUE; - FBDEVHWPTRLVAL(pScrn) = xnfcalloc(sizeof(fbdevHWRec), 1); + FBDEVHWPTRLVAL(pScrn) = xnfcalloc(1, sizeof(fbdevHWRec)); return TRUE; } diff --git a/hw/xfree86/int10/vbe.c b/hw/xfree86/int10/vbe.c index 26efdd76e..3c0f0761b 100644 --- a/hw/xfree86/int10/vbe.c +++ b/hw/xfree86/int10/vbe.c @@ -374,7 +374,7 @@ VBEGetVBEInfo(vbeInfoPtr pVbe) if (R16(pVbe->pInt10->ax) != 0x4f) return NULL; - block = calloc(sizeof(VbeInfoBlock), 1); + block = calloc(1, sizeof(VbeInfoBlock)); block->VESASignature[0] = ((char *) pVbe->memory)[0]; block->VESASignature[1] = ((char *) pVbe->memory)[1]; block->VESASignature[2] = ((char *) pVbe->memory)[2]; @@ -886,7 +886,7 @@ VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock * vbe) bpp = mode->BitsPerPixel; - m = xnfcalloc(sizeof(vbeModeInfoRec), 1); + m = xnfcalloc(1, sizeof(vbeModeInfoRec)); m->width = mode->XResolution; m->height = mode->YResolution; m->bpp = bpp; diff --git a/hw/xfree86/int10/vbeModes.c b/hw/xfree86/int10/vbeModes.c index 980e40b9c..244e84858 100644 --- a/hw/xfree86/int10/vbeModes.c +++ b/hw/xfree86/int10/vbeModes.c @@ -240,7 +240,7 @@ CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe, int id, VBEFreeModeInfo(mode); return NULL; } - pMode = xnfcalloc(sizeof(DisplayModeRec), 1); + pMode = xnfcalloc(1, sizeof(DisplayModeRec)); pMode->status = MODE_OK; pMode->type = M_T_BUILTIN; @@ -249,7 +249,7 @@ CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe, int id, pMode->HDisplay = mode->XResolution; pMode->VDisplay = mode->YResolution; - data = xnfcalloc(sizeof(VbeModeInfoData), 1); + data = xnfcalloc(1, sizeof(VbeModeInfoData)); data->mode = id; data->data = mode; pMode->PrivSize = sizeof(VbeModeInfoData); @@ -404,7 +404,7 @@ VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Attempting to use %dHz refresh for mode \"%s\" (%x)\n", (int) pMode->VRefresh, pMode->name, data->mode); - data->block = calloc(sizeof(VbeCRTCInfoBlock), 1); + data->block = calloc(1, sizeof(VbeCRTCInfoBlock)); data->block->HorizontalTotal = best->HTotal; data->block->HorizontalSyncStart = best->HSyncStart; data->block->HorizontalSyncEnd = best->HSyncEnd; diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index c6e89e66f..cf84112b1 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -88,7 +88,7 @@ xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs) xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CrtcPtr crtc, *crtcs; - crtc = calloc(sizeof(xf86CrtcRec), 1); + crtc = calloc(1, sizeof(xf86CrtcRec)); if (!crtc) return NULL; crtc->version = XF86_CRTC_VERSION; @@ -640,7 +640,7 @@ xf86OutputCreate(ScrnInfoPtr scrn, else len = 0; - output = calloc(sizeof(xf86OutputRec) + len, 1); + output = calloc(1, sizeof(xf86OutputRec) + len); if (!output) return NULL; output->scrn = scrn; diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c index cb14368f8..3c7119d46 100644 --- a/hw/xfree86/os-support/bus/Sbus.c +++ b/hw/xfree86/os-support/bus/Sbus.c @@ -427,7 +427,7 @@ sparcPromAssignNodes(void) xf86ErrorF("Inconsistent /proc/fb with FBIOGATTR\n"); } else if (!devicePtrs[fbNum]) { - devicePtrs[fbNum] = psdp = xnfcalloc(sizeof(sbusDevice), 1); + devicePtrs[fbNum] = psdp = xnfcalloc(1, sizeof(sbusDevice)); psdp->devId = devId; psdp->fbNum = fbNum; psdp->fd = -2; diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c index c1bc6fac7..fd2a07f1b 100644 --- a/hw/xfree86/os-support/linux/lnx_agp.c +++ b/hw/xfree86/os-support/linux/lnx_agp.c @@ -133,7 +133,7 @@ xf86GetAGPInfo(int screenNum) if (!GARTInit(screenNum)) return NULL; - if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) { + if ((info = calloc(1, sizeof(AgpInfo))) == NULL) { xf86DrvMsg(screenNum, X_ERROR, "xf86GetAGPInfo: Failed to allocate AgpInfo\n"); return NULL; diff --git a/hw/xfree86/os-support/solaris/sun_agp.c b/hw/xfree86/os-support/solaris/sun_agp.c index 0e5bdb1c5..8dd099b86 100644 --- a/hw/xfree86/os-support/solaris/sun_agp.c +++ b/hw/xfree86/os-support/solaris/sun_agp.c @@ -126,7 +126,7 @@ xf86GetAGPInfo(int screenNum) return NULL; } - if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) { + if ((info = calloc(1, sizeof(AgpInfo))) == NULL) { xf86DrvMsg(screenNum, X_ERROR, "xf86GetAGPInfo: Failed to allocate AgpInfo\n"); return NULL; diff --git a/hw/xfree86/vgahw/vgaHW.c b/hw/xfree86/vgahw/vgaHW.c index 00e30e8c9..f8a1409fc 100644 --- a/hw/xfree86/vgahw/vgaHW.c +++ b/hw/xfree86/vgahw/vgaHW.c @@ -1627,7 +1627,7 @@ vgaHWGetHWRec(ScrnInfoPtr scrp) */ if (VGAHWPTR(scrp)) return TRUE; - hwp = VGAHWPTRLVAL(scrp) = xnfcalloc(sizeof(vgaHWRec), 1); + hwp = VGAHWPTRLVAL(scrp) = xnfcalloc(1, sizeof(vgaHWRec)); regp = &VGAHWPTR(scrp)->ModeReg; if ((!vgaHWAllocDefaultRegs(&VGAHWPTR(scrp)->SavedReg)) || @@ -1921,7 +1921,7 @@ vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed) if (hwp->ddc != NULL) break; - hwp->ddc = xnfcalloc(sizeof(struct _vgaDdcSave), 1); + hwp->ddc = xnfcalloc(1, sizeof(struct _vgaDdcSave)); save = (struct _vgaDdcSave *) hwp->ddc; /* Lightpen register disable - allow access to cr10 & 11; just in case */ save->cr03 = hwp->readCrtc(hwp, 0x03); diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c index d810e2dfe..e5c55d8ba 100644 --- a/hw/xquartz/GL/visualConfigs.c +++ b/hw/xquartz/GL/visualConfigs.c @@ -117,7 +117,7 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) * __glXScreenDestroy now walks all the fbconfigs and frees them one at a time. * See 4b0a3cbab131eb453e2b3fc0337121969258a7be. */ - visualConfigs = calloc(sizeof(*visualConfigs), 1); + visualConfigs = calloc(1, sizeof(*visualConfigs)); l = NULL; c = visualConfigs; /* current buffer */ @@ -136,7 +136,7 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) // Global c->visualID = -1; c->visualType = GLX_TRUE_COLOR; - c->next = calloc(sizeof(*visualConfigs), 1); + c->next = calloc(1, sizeof(*visualConfigs)); assert(c->next); c->level = 0; diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index 4bbe56b93..38f5dbcdd 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -117,7 +117,7 @@ QuartzAddScreen(int index, // The clang static analyzer thinks we leak displayInfo here #ifndef __clang_analyzer__ // allocate space for private per screen Quartz specific storage - QuartzScreenPtr displayInfo = calloc(sizeof(QuartzScreenRec), 1); + QuartzScreenPtr displayInfo = calloc(1, sizeof(QuartzScreenRec)); // QUARTZ_PRIV(pScreen) = displayInfo; dixSetPrivate(&pScreen->devPrivates, quartzScreenKey, displayInfo); diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index ebc990b57..6a73efe04 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -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; diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index 0a7f710a3..d7e0a125a 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -2872,7 +2872,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; @@ -2903,7 +2903,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; @@ -2926,7 +2926,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; diff --git a/hw/xwin/winallpriv.c b/hw/xwin/winallpriv.c index 1212cbba9..7e96ae3d8 100644 --- a/hw/xwin/winallpriv.c +++ b/hw/xwin/winallpriv.c @@ -58,7 +58,7 @@ winAllocatePrivates(ScreenPtr pScreen) } /* Allocate memory for the screen private structure */ - pScreenPriv = calloc(sizeof(winPrivScreenRec), 1); + pScreenPriv = calloc(1, sizeof(winPrivScreenRec)); if (!pScreenPriv) { ErrorF("winAllocateScreenPrivates - malloc () failed\n"); return FALSE; @@ -140,7 +140,7 @@ winAllocateCmapPrivates(ColormapPtr pCmap) } /* Allocate memory for our private structure */ - pCmapPriv = calloc(sizeof(winPrivCmapRec), 1); + pCmapPriv = calloc(1, sizeof(winPrivCmapRec)); if (!pCmapPriv) { ErrorF("winAllocateCmapPrivates - malloc () failed\n"); return FALSE; diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index a50d96bfd..2d5ebc2f5 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -1395,9 +1395,9 @@ winInitWM(void **ppWMInfo, pthread_mutex_t * ppmServerStarted, int dwScreen, HWND hwndScreen, Bool compositeWM) { - WMProcArgPtr pArg = calloc(sizeof(WMProcArgRec), 1); - WMInfoPtr pWMInfo = calloc(sizeof(WMInfoRec), 1); - XMsgProcArgPtr pXMsgArg = calloc(sizeof(XMsgProcArgRec), 1); + WMProcArgPtr pArg = calloc(1, sizeof(WMProcArgRec)); + WMInfoPtr pWMInfo = calloc(1, sizeof(WMInfoRec)); + XMsgProcArgPtr pXMsgArg = calloc(1, sizeof(XMsgProcArgRec)); /* Bail if the input parameters are bad */ if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) { diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c index 6b61d85e3..560b50cf9 100644 --- a/hw/xwin/winshadgdi.c +++ b/hw/xwin/winshadgdi.c @@ -1162,8 +1162,8 @@ winCreateColormapShadowGDI(ColormapPtr pColormap) dwEntriesMax = pVisual->ColormapEntries; /* Allocate a Windows logical color palette with max entries */ - lpPaletteNew = calloc(sizeof(LOGPALETTE) - + (dwEntriesMax - 1) * sizeof(PALETTEENTRY), 1); + lpPaletteNew = calloc(1, sizeof(LOGPALETTE) + + (dwEntriesMax - 1) * sizeof(PALETTEENTRY)); if (lpPaletteNew == NULL) { ErrorF("winCreateColormapShadowGDI - Couldn't allocate palette " "with %d entries\n", (int) dwEntriesMax); diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 8f4752d61..652525b5b 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -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;