From 5d0ce67ac3962a177d19fa1dc327829f17c7d694 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 10 May 2024 10:47:12 +0200 Subject: [PATCH] (submit/cleanup-alloc-funcs) treewide: replace xnfcalloc() calls by XNFcallocarray() This has been nothing but an alias for two decades now (somewhere in R6.6), so there doesn't seem to be any practical need for this indirection. The macro still needs to remain, as long as (external) drivers still using it. Signed-off-by: Enrico Weigelt, metux IT consult --- config/config.c | 2 +- hw/kdrive/ephyr/ephyr_glamor_xv.c | 6 ++-- hw/xfree86/common/xf86AutoConfig.c | 2 +- hw/xfree86/common/xf86Bus.c | 6 ++-- hw/xfree86/common/xf86Config.c | 30 +++++++++---------- hw/xfree86/common/xf86Configure.c | 4 +-- hw/xfree86/common/xf86Helper.c | 8 ++--- hw/xfree86/common/xf86Mode.c | 4 +-- hw/xfree86/common/xf86sbusBus.c | 6 ++-- hw/xfree86/ddc/interpret_edid.c | 2 +- hw/xfree86/doc/ddxDesign.xml | 4 +-- hw/xfree86/dri/dri.c | 2 +- hw/xfree86/drivers/modesetting/driver.c | 4 +-- .../drivers/modesetting/drmmode_display.c | 2 +- hw/xfree86/fbdevhw/fbdevhw.c | 2 +- hw/xfree86/int10/generic.c | 6 ++-- hw/xfree86/int10/vbe.c | 2 +- hw/xfree86/int10/vbeModes.c | 4 +-- hw/xfree86/modes/xf86Crtc.c | 14 ++++----- hw/xfree86/modes/xf86EdidModes.c | 2 +- hw/xfree86/modes/xf86Modes.c | 4 +-- hw/xfree86/modes/xf86gtf.c | 2 +- hw/xfree86/os-support/bus/Sbus.c | 2 +- hw/xfree86/os-support/linux/int10/linux.c | 6 ++-- hw/xfree86/vgahw/vgaHW.c | 4 +-- hw/xwayland/xwayland-glamor-xv.c | 14 ++++----- hw/xwayland/xwayland-window.c | 4 +-- 27 files changed, 74 insertions(+), 74 deletions(-) diff --git a/config/config.c b/config/config.c index fb60295ae..ae67dde27 100644 --- a/config/config.c +++ b/config/config.c @@ -133,7 +133,7 @@ struct OdevAttributes * config_odev_allocate_attributes(void) { struct OdevAttributes *attribs = - xnfcalloc(1, sizeof (struct OdevAttributes)); + XNFcallocarray(1, sizeof (struct OdevAttributes)); attribs->fd = -1; return attribs; } diff --git a/hw/kdrive/ephyr/ephyr_glamor_xv.c b/hw/kdrive/ephyr/ephyr_glamor_xv.c index b5eae48c8..62e7adaeb 100644 --- a/hw/kdrive/ephyr/ephyr_glamor_xv.c +++ b/hw/kdrive/ephyr/ephyr_glamor_xv.c @@ -123,7 +123,7 @@ ephyr_glamor_xv_init(ScreenPtr screen) glamor_xv_core_init(screen); - adaptor = xnfcalloc(1, sizeof(*adaptor)); + adaptor = XNFcallocarray(1, sizeof(*adaptor)); adaptor->name = "glamor textured video"; adaptor->type = XvWindowMask | XvInputMask | XvImageMask; @@ -135,9 +135,9 @@ ephyr_glamor_xv_init(ScreenPtr screen) adaptor->nFormats = NUM_FORMATS; adaptor->nPorts = 16; /* Some absurd number */ - port_privates = xnfcalloc(adaptor->nPorts, + port_privates = XNFcallocarray(adaptor->nPorts, sizeof(glamor_port_private)); - adaptor->pPortPrivates = xnfcalloc(adaptor->nPorts, + adaptor->pPortPrivates = XNFcallocarray(adaptor->nPorts, sizeof(glamor_port_private *)); for (i = 0; i < adaptor->nPorts; i++) { adaptor->pPortPrivates[i].ptr = &port_privates[i]; diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c index 7311d8ddc..a63b53676 100644 --- a/hw/xfree86/common/xf86AutoConfig.c +++ b/hw/xfree86/common/xf86AutoConfig.c @@ -403,7 +403,7 @@ autoConfigDevice(GDevPtr preconf_device) * minus one for the already existing first one * plus one for the terminating NULL */ for (; slp[num_screens].screen; num_screens++); - xf86ConfigLayout.screens = xnfcalloc(num_screens + md.nmatches, + xf86ConfigLayout.screens = XNFcallocarray(num_screens + md.nmatches, sizeof(screenLayoutRec)); xf86ConfigLayout.screens[0] = slp[0]; diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 687769c31..5e5cdb1a6 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -299,9 +299,9 @@ xf86AllocateEntity(void) xf86NumEntities++; xf86Entities = XNFreallocarray(xf86Entities, xf86NumEntities, sizeof(EntityPtr)); - xf86Entities[xf86NumEntities - 1] = xnfcalloc(1, sizeof(EntityRec)); + xf86Entities[xf86NumEntities - 1] = XNFcallocarray(1, sizeof(EntityRec)); xf86Entities[xf86NumEntities - 1]->entityPrivates = - xnfcalloc(xf86EntityPrivateCount, sizeof(DevUnion)); + XNFcallocarray(xf86EntityPrivateCount, sizeof(DevUnion)); return xf86NumEntities - 1; } @@ -500,7 +500,7 @@ xf86GetEntityInfo(int entityIndex) if (entityIndex >= xf86NumEntities) return NULL; - pEnt = xnfcalloc(1, sizeof(EntityInfoRec)); + pEnt = XNFcallocarray(1, sizeof(EntityInfoRec)); pEnt->index = entityIndex; pEnt->location = xf86Entities[entityIndex]->bus; pEnt->active = xf86Entities[entityIndex]->active; diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 8c4c9842c..c3e77350f 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -184,7 +184,7 @@ xf86ValidateFontPath(char *path) while (next != NULL) { path_elem = xf86GetPathElem(&next); if (*path_elem == '/') { - dir_elem = xnfcalloc(1, strlen(path_elem) + 1); + dir_elem = XNFcallocarray(1, strlen(path_elem) + 1); if ((p1 = strchr(path_elem, ':')) != 0) dirlen = p1 - path_elem; else @@ -334,7 +334,7 @@ xf86ModulelistFromConfig(void ***optlist) } } else { - xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec)); + xf86configptr->conf_modules = XNFcallocarray(1, sizeof(XF86ConfModuleRec)); for (i = 0; ModuleDefaults[i].name != NULL; i++) { if (ModuleDefaults[i].toLoad == TRUE) { XF86LoadPtr ptr = (XF86LoadPtr) xf86configptr->conf_modules; @@ -1346,7 +1346,7 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp) } DebugF("Found %d input devices in the layout section %s\n", count, layout->lay_identifier); - indp = xnfcalloc((count + 1), sizeof(InputInfoPtr)); + indp = XNFcallocarray((count + 1), sizeof(InputInfoPtr)); indp[count] = NULL; irp = layout->lay_input_lst; count = 0; @@ -1430,7 +1430,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, if (!count) /* alloc enough storage even if no screen is specified */ count = 1; - slp = xnfcalloc((count + 1), sizeof(screenLayoutRec)); + slp = XNFcallocarray((count + 1), sizeof(screenLayoutRec)); slp[count].screen = NULL; /* * now that we have storage, loop over the list again and fill in our @@ -1440,7 +1440,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, adjp = conf_layout->lay_adjacency_lst; count = 0; while (adjp) { - slp[count].screen = xnfcalloc(1, sizeof(confScreenRec)); + slp[count].screen = XNFcallocarray(1, sizeof(confScreenRec)); if (adjp->adj_scrnum < 0) scrnum = count; else @@ -1494,7 +1494,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, XF86ConfScreenPtr screen; FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen); - slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); + slp[0].screen = XNFcallocarray(1, sizeof(confScreenRec)); if (!configScreen(slp[0].screen, screen, 0, X_CONFIG, TRUE)) { free(slp[0].screen); @@ -1622,8 +1622,8 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, /* We have exactly one screen */ - slp = xnfcalloc(1, 2 * sizeof(screenLayoutRec)); - slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); + slp = XNFcallocarray(1, 2 * sizeof(screenLayoutRec)); + slp[0].screen = XNFcallocarray(1, sizeof(confScreenRec)); slp[1].screen = NULL; if (!configScreen(slp[0].screen, conf_screen, 0, from, TRUE)) { free(slp); @@ -1631,7 +1631,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, } servlayoutp->id = "(implicit)"; servlayoutp->screens = slp; - servlayoutp->inactives = xnfcalloc(1, sizeof(GDevRec)); + servlayoutp->inactives = XNFcallocarray(1, sizeof(GDevRec)); servlayoutp->options = NULL; memset(&layout, 0, sizeof(layout)); @@ -1716,7 +1716,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, screenp->defaultdepth = conf_screen->scrn_defaultdepth; screenp->defaultbpp = conf_screen->scrn_defaultbpp; screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp; - screenp->monitor = xnfcalloc(1, sizeof(MonRec)); + screenp->monitor = XNFcallocarray(1, sizeof(MonRec)); /* If no monitor is specified, create a default one. */ if (!conf_screen->scrn_monitor) { XF86ConfMonitorRec defMon; @@ -1734,7 +1734,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, /* Configure the device. If there isn't one configured, attach to the * first inactive one that we can configure. If there's none that work, * set it to NULL so that the section can be autoconfigured later */ - screenp->device = xnfcalloc(1, sizeof(GDevRec)); + screenp->device = XNFcallocarray(1, sizeof(GDevRec)); if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) { FIND_SUITABLE (XF86ConfDevicePtr, xf86configptr->conf_device_lst, conf_screen->scrn_device); xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n" @@ -1777,7 +1777,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, continue; } - screenp->gpu_devices[i] = xnfcalloc(1, sizeof(GDevRec)); + screenp->gpu_devices[i] = XNFcallocarray(1, sizeof(GDevRec)); if (configDevice(screenp->gpu_devices[i], conf_screen->scrn_gpu_devices[i], TRUE, TRUE)) { screenp->gpu_devices[i]->myScreenSection = screenp; } @@ -1787,7 +1787,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, } else { for (i = 0; i < conf_screen->num_gpu_devices; i++) { - screenp->gpu_devices[i] = xnfcalloc(1, sizeof(GDevRec)); + screenp->gpu_devices[i] = XNFcallocarray(1, sizeof(GDevRec)); if (configDevice(screenp->gpu_devices[i], conf_screen->scrn_gpu_devices[i], TRUE, TRUE)) { screenp->gpu_devices[i]->myScreenSection = screenp; } @@ -1813,7 +1813,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, dispptr = (XF86ConfDisplayPtr) dispptr->list.next, count++) { /* Allocate individual Display records */ - screenp->displays[count] = xnfcalloc(1, sizeof(DispRec)); + screenp->displays[count] = XNFcallocarray(1, sizeof(DispRec)); /* Fill in the default Virtual size, if any */ if (conf_screen->scrn_virtualX && conf_screen->scrn_virtualY) { @@ -1936,7 +1936,7 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor) */ cmodep = conf_monitor->mon_modeline_lst; while (cmodep) { - mode = xnfcalloc(1, sizeof(DisplayModeRec)); + mode = XNFcallocarray(1, sizeof(DisplayModeRec)); mode->type = 0; mode->Clock = cmodep->ml_clock; mode->HDisplay = cmodep->ml_hdisplay; diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index c342829e3..24602a879 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -707,10 +707,10 @@ DoConfigure(void) xf86DoConfigurePass1 = FALSE; - dev2screen = xnfcalloc(nDevToConfig, sizeof(int)); + dev2screen = XNFcallocarray(nDevToConfig, sizeof(int)); { - Bool *driverProbed = xnfcalloc(xf86NumDrivers, sizeof(Bool)); + Bool *driverProbed = XNFcallocarray(xf86NumDrivers, sizeof(Bool)); for (screennum = 0; screennum < nDevToConfig; screennum++) { int k, l, n, oldNumScreens; diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 712ce7624..e424bf394 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] = XNFcallocarray(sizeof(ScrnInfoRec), 1); 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] = XNFcallocarray(sizeof(ScrnInfoRec), 1); 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 = XNFcallocarray(sizeof(DevUnion), xf86ScrnInfoPrivateCount); /* * EnableDisableFBAccess now gets initialized in InitOutput() * pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess; @@ -566,7 +566,7 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp, "Creating default Display subsection in Screen section\n" "\t\"%s\" for depth/fbbpp %d/%d\n", scrp->confScreen->id, scrp->depth, scrp->bitsPerPixel); - scrp->confScreen->displays[i] = xnfcalloc(1, sizeof(DispRec)); + scrp->confScreen->displays[i] = XNFcallocarray(1, sizeof(DispRec)); memset(scrp->confScreen->displays[i], 0, sizeof(DispRec)); scrp->confScreen->displays[i]->blackColour.red = -1; scrp->confScreen->displays[i]->blackColour.green = -1; diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c index c20334dde..1f2de02fb 100644 --- a/hw/xfree86/common/xf86Mode.c +++ b/hw/xfree86/common/xf86Mode.c @@ -1615,7 +1615,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, if (modeNames != NULL) { for (i = 0; modeNames[i] != NULL; i++) { userModes = TRUE; - new = xnfcalloc(1, sizeof(DisplayModeRec)); + new = XNFcallocarray(1, sizeof(DisplayModeRec)); new->prev = last; new->type = M_T_USERDEF; new->name = xnfstrdup(modeNames[i]); @@ -1683,7 +1683,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, if (r == NULL) break; - p = xnfcalloc(1, sizeof(DisplayModeRec)); + p = XNFcallocarray(1, sizeof(DisplayModeRec)); p->prev = last; p->name = xnfstrdup(r->name); if (!userModes) diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c index bda7338ff..6c3ed051f 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 = XNFcallocarray(sizeof(sbusDevice), 1); psdp->devId = sbusDeviceTable[i].devId; psdp->fbNum = fbNum; psdp->device = xnfstrdup(device); @@ -589,7 +589,7 @@ xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp) { DisplayModePtr mode; - mode = xnfcalloc(sizeof(DisplayModeRec), 1); + mode = XNFcallocarray(sizeof(DisplayModeRec), 1); mode->name = "current"; mode->next = mode; mode->prev = mode; @@ -698,7 +698,7 @@ xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp) if (!dixRegisterPrivateKey(sbusPaletteKey, PRIVATE_SCREEN, 0)) FatalError("Cannot register sbus private key"); - cmap = xnfcalloc(1, sizeof(sbusCmapRec)); + cmap = XNFcallocarray(1, sizeof(sbusCmapRec)); dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap); cmap->psdp = psdp; fbcmap.index = 0; diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c index 7259d2192..0ff8c4237 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 = XNFcallocarray(sizeof(xf86Monitor), 1))) return NULL; m->scrnIndex = scrnIndex; m->rawData = block; diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml index b7da50de3..19c3b764c 100644 --- a/hw/xfree86/doc/ddxDesign.xml +++ b/hw/xfree86/doc/ddxDesign.xml @@ -7818,7 +7818,7 @@ zzzSetup(pointer module, pointer opts, int *errmaj, int *errmin) The ScrnInfoRec's driverPrivate is initialised to NULL, so it is easy to check if the initialisation has already been done. After allocating it, initialise - the fields. By using xnfcalloc() to do the allocation + the fields. By using XNFcallocarray() to do the allocation it is zeroed, and if the allocation fails the server exits. @@ -7837,7 +7837,7 @@ ZZZGetRec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate != NULL) return TRUE; - pScrn->driverPrivate = xnfcalloc(sizeof(ZZZRec), 1); + pScrn->driverPrivate = XNFcallocarray(sizeof(ZZZRec), 1); /* Initialise as required */ ... return TRUE; diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index 7ba879ce3..ccf9efe1e 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -260,7 +260,7 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn, tmp.resOwner = NULL; if (!pDRIEntPriv) - pDRIEntPriv = xnfcalloc(sizeof(*pDRIEntPriv), 1); + pDRIEntPriv = XNFcallocarray(sizeof(*pDRIEntPriv), 1); if (!pDRIEntPriv) { DRIDrvMsg(-1, X_INFO, "[drm] Failed to allocate memory for " diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index f3400a1cd..4d49f5ece 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 = XNFcallocarray(sizeof(modesettingEntRec), 1); } #ifdef XSERVER_LIBPCIACCESS @@ -515,7 +515,7 @@ GetRec(ScrnInfoPtr pScrn) if (pScrn->driverPrivate) return TRUE; - pScrn->driverPrivate = xnfcalloc(sizeof(modesettingRec), 1); + pScrn->driverPrivate = XNFcallocarray(sizeof(modesettingRec), 1); return TRUE; } diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 01553e237..86305d289 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -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 = XNFcallocarray(sizeof(drmmode_crtc_private_rec), 1); crtc->driver_private = drmmode_crtc; drmmode_crtc->mode_crtc = drmModeGetCrtc(drmmode->fd, mode_res->crtcs[num]); diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index 76b96430f..4482a8073 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) = XNFcallocarray(sizeof(fbdevHWRec), 1); return TRUE; } diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index ec4e4c175..4d8dfb4de 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -133,13 +133,13 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) return NULL; } - pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec)); + pInt = (xf86Int10InfoPtr) XNFcallocarray(1, sizeof(xf86Int10InfoRec)); pInt->entityIndex = entityIndex; if (!xf86Int10ExecSetup(pInt)) goto error0; pInt->mem = &genericMem; - pInt->private = (void *) xnfcalloc(1, sizeof(genericInt10Priv)); - INTPriv(pInt)->alloc = (void *) xnfcalloc(1, ALLOC_ENTRIES(getpagesize())); + pInt->private = (void *) XNFcallocarray(1, sizeof(genericInt10Priv)); + INTPriv(pInt)->alloc = (void *) XNFcallocarray(1, ALLOC_ENTRIES(getpagesize())); pInt->pScrn = pScrn; base = INTPriv(pInt)->base = XNFalloc(SYS_BIOS); diff --git a/hw/xfree86/int10/vbe.c b/hw/xfree86/int10/vbe.c index a0614fed5..1481819fd 100644 --- a/hw/xfree86/int10/vbe.c +++ b/hw/xfree86/int10/vbe.c @@ -886,7 +886,7 @@ VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock * vbe) bpp = mode->BitsPerPixel; - m = xnfcalloc(sizeof(vbeModeInfoRec), 1); + m = XNFcallocarray(sizeof(vbeModeInfoRec), 1); 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..27618aa6e 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 = XNFcallocarray(sizeof(DisplayModeRec), 1); 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 = XNFcallocarray(sizeof(VbeModeInfoData), 1); data->mode = id; data->data = mode; pMode->PrivSize = sizeof(VbeModeInfoData); diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 0c25fce8f..9982fab26 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -59,7 +59,7 @@ xf86CrtcConfigInit(ScrnInfoPtr scrn, const xf86CrtcConfigFuncsRec * funcs) if (xf86CrtcConfigPrivateIndex == -1) xf86CrtcConfigPrivateIndex = xf86AllocateScrnInfoPrivateIndex(); - config = xnfcalloc(1, sizeof(xf86CrtcConfigRec)); + config = XNFcallocarray(1, sizeof(xf86CrtcConfigRec)); config->funcs = funcs; config->compat_output = -1; @@ -2284,8 +2284,8 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, DisplayModePtr *preferred, *preferred_match; Bool ret = FALSE; - preferred = xnfcalloc(config->num_output, sizeof(DisplayModePtr)); - preferred_match = xnfcalloc(config->num_output, sizeof(DisplayModePtr)); + preferred = XNFcallocarray(config->num_output, sizeof(DisplayModePtr)); + preferred_match = XNFcallocarray(config->num_output, sizeof(DisplayModePtr)); /* Check if the preferred mode is available on all outputs */ for (p = -1; nextEnabledOutput(config, enabled, &p);) { @@ -2394,7 +2394,7 @@ xf86TargetAspect(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, Bool ret = FALSE; DisplayModePtr guess = NULL, aspect_guess = NULL, base_guess = NULL; - aspects = xnfcalloc(config->num_output, sizeof(float)); + aspects = XNFcallocarray(config->num_output, sizeof(float)); /* collect the aspect ratios */ for (o = -1; nextEnabledOutput(config, enabled, &o);) { @@ -2571,9 +2571,9 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow) xf86ProbeOutputModes(scrn, width, height); - crtcs = xnfcalloc(config->num_output, sizeof(xf86CrtcPtr)); - modes = xnfcalloc(config->num_output, sizeof(DisplayModePtr)); - enabled = xnfcalloc(config->num_output, sizeof(Bool)); + crtcs = XNFcallocarray(config->num_output, sizeof(xf86CrtcPtr)); + modes = XNFcallocarray(config->num_output, sizeof(DisplayModePtr)); + enabled = XNFcallocarray(config->num_output, sizeof(Bool)); ret = xf86CollectEnabledOutputs(scrn, config, enabled); if (ret == FALSE && canGrow) { diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index 1ac573867..b0f93e2b7 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -596,7 +596,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, " sync.\n", __func__, timing->h_active, timing->v_active); } - Mode = xnfcalloc(1, sizeof(DisplayModeRec)); + Mode = XNFcallocarray(1, sizeof(DisplayModeRec)); Mode->type = M_T_DRIVER; if (preferred) diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index e8283db0c..b0cead26f 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -322,7 +322,7 @@ void xf86PrintModeline(int scrnIndex, DisplayModePtr mode) { char tmp[256]; - char *flags = xnfcalloc(1, 1); + char *flags = XNFcallocarray(1, 1); #define TBITS 6 const char tchar[TBITS + 1] = "UezdPb"; @@ -802,7 +802,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Interlaced) { struct libxcvt_mode_info *libxcvt_mode_info; - DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec)); + DisplayModeRec *Mode = XNFcallocarray(1, sizeof(DisplayModeRec)); char *tmp; libxcvt_mode_info = diff --git a/hw/xfree86/modes/xf86gtf.c b/hw/xfree86/modes/xf86gtf.c index c6a738422..b67233f90 100644 --- a/hw/xfree86/modes/xf86gtf.c +++ b/hw/xfree86/modes/xf86gtf.c @@ -100,7 +100,7 @@ DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins) { - DisplayModeRec *mode = xnfcalloc(1, sizeof(DisplayModeRec)); + DisplayModeRec *mode = XNFcallocarray(1, sizeof(DisplayModeRec)); float h_pixels_rnd; float v_lines_rnd; diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c index 15fab8293..edb71a59d 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 = XNFcallocarray(sizeof(sbusDevice), 1); psdp->devId = devId; psdp->fbNum = fbNum; psdp->fd = -2; diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c index 42f872dd2..62fdaa434 100644 --- a/hw/xfree86/os-support/linux/int10/linux.c +++ b/hw/xfree86/os-support/linux/int10/linux.c @@ -135,7 +135,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) } } - pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec)); + pInt = (xf86Int10InfoPtr) XNFcallocarray(1, sizeof(xf86Int10InfoRec)); pInt->pScrn = pScrn; pInt->entityIndex = entityIndex; pInt->dev = xf86GetPciInfoForEntity(entityIndex); @@ -144,9 +144,9 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) goto error0; pInt->mem = &linuxMem; pagesize = getpagesize(); - pInt->private = (void *) xnfcalloc(1, sizeof(linuxInt10Priv)); + pInt->private = (void *) XNFcallocarray(1, sizeof(linuxInt10Priv)); ((linuxInt10Priv *) pInt->private)->alloc = - (void *) xnfcalloc(1, ALLOC_ENTRIES(pagesize)); + (void *) XNFcallocarray(1, ALLOC_ENTRIES(pagesize)); if (!xf86IsEntityPrimary(entityIndex)) { DebugF("Mapping high memory area\n"); diff --git a/hw/xfree86/vgahw/vgaHW.c b/hw/xfree86/vgahw/vgaHW.c index 00e30e8c9..dd84d655b 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) = XNFcallocarray(sizeof(vgaHWRec), 1); 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 = XNFcallocarray(sizeof(struct _vgaDdcSave), 1); 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/xwayland/xwayland-glamor-xv.c b/hw/xwayland/xwayland-glamor-xv.c index f1c5ca1b2..68bae5737 100644 --- a/hw/xwayland/xwayland-glamor-xv.c +++ b/hw/xwayland/xwayland-glamor-xv.c @@ -203,7 +203,7 @@ xwl_glamor_xv_add_formats(XvAdaptorPtr pa) int i; totFormat = NUM_FORMATS; - pFormat = xnfcalloc(totFormat, sizeof(XvFormatRec)); + pFormat = XNFcallocarray(totFormat, sizeof(XvFormatRec)); pScreen = pa->pScreen; for (pf = pFormat, i = 0, numFormat = 0; i < NUM_FORMATS; i++) { numVisuals = pScreen->numVisuals; @@ -246,10 +246,10 @@ xwl_glamor_xv_add_ports(XvAdaptorPtr pa) int nPorts; int i; - pPorts = xnfcalloc(NUM_PORTS, sizeof(XvPortRec)); + pPorts = XNFcallocarray(NUM_PORTS, sizeof(XvPortRec)); xwlXvScreen = dixLookupPrivate(&(pa->pScreen)->devPrivates, xwlXvScreenPrivateKey); - xwlXvScreen->port_privates = xnfcalloc(NUM_PORTS, + xwlXvScreen->port_privates = XNFcallocarray(NUM_PORTS, sizeof(glamor_port_private)); PortResource = XvGetRTPort(); @@ -280,7 +280,7 @@ xwl_glamor_xv_add_attributes(XvAdaptorPtr pa) { int i; - pa->pAttributes = xnfcalloc(glamor_xv_num_attributes, sizeof(XvAttributeRec)); + pa->pAttributes = XNFcallocarray(glamor_xv_num_attributes, sizeof(XvAttributeRec)); memcpy(pa->pAttributes, glamor_xv_attributes, glamor_xv_num_attributes * sizeof(XvAttributeRec)); @@ -293,7 +293,7 @@ xwl_glamor_xv_add_attributes(XvAdaptorPtr pa) static void xwl_glamor_xv_add_images(XvAdaptorPtr pa) { - pa->pImages = xnfcalloc(glamor_xv_num_images, sizeof(XvImageRec)); + pa->pImages = XNFcallocarray(glamor_xv_num_images, sizeof(XvImageRec)); memcpy(pa->pImages, glamor_xv_images, glamor_xv_num_images * sizeof(XvImageRec)); pa->nImages = glamor_xv_num_images; @@ -307,7 +307,7 @@ xwl_glamor_xv_add_encodings(XvAdaptorPtr pa) glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texsize); - pe = xnfcalloc(1, sizeof(XvEncodingRec)); + pe = XNFcallocarray(1, sizeof(XvEncodingRec)); pe->id = 0; pe->pScreen = pa->pScreen; pe->name = strdup(ENCODER_NAME); @@ -337,7 +337,7 @@ xwl_glamor_xv_add_adaptors(ScreenPtr pScreen) XvScreen->nAdaptors = 0; XvScreen->pAdaptors = NULL; - pa = xnfcalloc(1, sizeof(XvAdaptorRec)); + pa = XNFcallocarray(1, sizeof(XvAdaptorRec)); pa->pScreen = pScreen; pa->type = (unsigned char) (XvInputMask | XvImageMask); pa->ddStopVideo = xwl_glamor_xv_stop_video; diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index 12bb3009c..1e9780b63 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -1055,7 +1055,7 @@ xwl_window_enter_output(struct xwl_window *xwl_window, struct xwl_output *xwl_ou { struct xwl_window_output *window_output; - window_output = xnfcalloc(1, sizeof(struct xwl_window_output)); + window_output = XNFcallocarray(1, sizeof(struct xwl_window_output)); window_output->xwl_output = xwl_output; xorg_list_add(&window_output->link, &xwl_window->xwl_output_list); } @@ -1618,7 +1618,7 @@ release_wl_surface_for_window_legacy_delay(struct xwl_window *xwl_window) * and Wayland processing so that the compositor has the time to * establish the association before the wl_surface is destroyed. */ - xwl_wl_surface = xnfcalloc(1, sizeof *xwl_wl_surface); + xwl_wl_surface = XNFcallocarray(1, sizeof *xwl_wl_surface); xwl_wl_surface->wl_surface = xwl_window->surface; xorg_list_add(&xwl_wl_surface->link, &xwl_window->xwl_screen->pending_wl_surface_destroy);