diff options
author | Eric Anholt <eric@anholt.net> | 2010-06-04 16:04:37 -0700 |
---|---|---|
committer | Owain G. Ainsworth <oga@openbsd.org> | 2010-06-07 21:06:49 +0100 |
commit | ae9f6675da8663d3b2706c7975c6160fea23f676 (patch) | |
tree | c703ed4ba9a6e53aa0ba705bc29b58473a4f4477 /src | |
parent | 8e7aaa46ce788c7661654868659894a42efb836d (diff) |
Use libc instead of deprecated libc wrappers for malloc/calloc/free.
Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
(cherrypick of part of this commit came from
2c1fda08e889cad07acb452230da06f9c383d21c by eric anholt)
Diffstat (limited to 'src')
-rw-r--r-- | src/drmmode_display.c | 22 | ||||
-rw-r--r-- | src/i810_dga.c | 4 | ||||
-rw-r--r-- | src/i810_dri.c | 50 | ||||
-rw-r--r-- | src/i810_driver.c | 12 | ||||
-rw-r--r-- | src/i810_hwmc.c | 10 | ||||
-rw-r--r-- | src/i810_video.c | 26 | ||||
-rw-r--r-- | src/i830_batchbuffer.c | 4 | ||||
-rw-r--r-- | src/i830_bios.c | 10 | ||||
-rw-r--r-- | src/i830_crt.c | 4 | ||||
-rw-r--r-- | src/i830_display.c | 2 | ||||
-rw-r--r-- | src/i830_dri.c | 42 | ||||
-rw-r--r-- | src/i830_driver.c | 16 | ||||
-rw-r--r-- | src/i830_dvo.c | 8 | ||||
-rw-r--r-- | src/i830_hdmi.c | 4 | ||||
-rw-r--r-- | src/i830_hwmc.c | 4 | ||||
-rw-r--r-- | src/i830_lvds.c | 4 | ||||
-rw-r--r-- | src/i830_memory.c | 44 | ||||
-rw-r--r-- | src/i830_quirks.c | 8 | ||||
-rw-r--r-- | src/i830_sdvo.c | 16 | ||||
-rw-r--r-- | src/i830_tv.c | 8 | ||||
-rw-r--r-- | src/i830_uxa.c | 10 | ||||
-rw-r--r-- | src/i830_video.c | 22 |
22 files changed, 163 insertions, 167 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index e0df3961..de40fe9b 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -336,7 +336,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, crtc->y = y; crtc->rotation = rotation; - output_ids = xcalloc(sizeof(uint32_t), xf86_config->num_output); + output_ids = calloc(sizeof(uint32_t), xf86_config->num_output); if (!output_ids) { ret = FALSE; goto done; @@ -729,7 +729,7 @@ static int drmmode_output_lvds_edid(xf86OutputPtr output, * device. This is similar to what we have done in i830_lvds.c */ edid_mon = NULL; - edid_mon = xcalloc(1, sizeof(xf86Monitor)); + edid_mon = calloc(1, sizeof(xf86Monitor)); if (!edid_mon) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "Can't allocate memory for edid_mon.\n"); @@ -869,17 +869,17 @@ drmmode_output_destroy(xf86OutputPtr output) drmModeFreePropertyBlob(drmmode_output->edid_blob); for (i = 0; i < drmmode_output->num_props; i++) { drmModeFreeProperty(drmmode_output->props[i].mode_prop); - xfree(drmmode_output->props[i].atoms); + free(drmmode_output->props[i].atoms); } - xfree(drmmode_output->props); + free(drmmode_output->props); drmModeFreeConnector(drmmode_output->mode_output); if (drmmode_output->private_data) { - xfree(drmmode_output->private_data); + free(drmmode_output->private_data); drmmode_output->private_data = NULL; } if (drmmode_output->backlight_iface) drmmode_backlight_set(output, drmmode_output->backlight_active_level); - xfree(drmmode_output); + free(drmmode_output); output->driver_private = NULL; } @@ -970,7 +970,7 @@ drmmode_output_create_resources(xf86OutputPtr output) drmModePropertyPtr drmmode_prop; int i, j, err; - drmmode_output->props = xcalloc(mode_output->count_props, sizeof(drmmode_prop_rec)); + drmmode_output->props = calloc(mode_output->count_props, sizeof(drmmode_prop_rec)); if (!drmmode_output->props) return; @@ -995,7 +995,7 @@ drmmode_output_create_resources(xf86OutputPtr output) INT32 range[2]; p->num_atoms = 1; - p->atoms = xcalloc(p->num_atoms, sizeof(Atom)); + p->atoms = calloc(p->num_atoms, sizeof(Atom)); if (!p->atoms) continue; p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE); @@ -1017,7 +1017,7 @@ drmmode_output_create_resources(xf86OutputPtr output) } } else if (drmmode_prop->flags & DRM_MODE_PROP_ENUM) { p->num_atoms = drmmode_prop->count_enums + 1; - p->atoms = xcalloc(p->num_atoms, sizeof(Atom)); + p->atoms = calloc(p->num_atoms, sizeof(Atom)); if (!p->atoms) continue; p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE); @@ -1262,7 +1262,7 @@ drmmode_output_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, int num) return; } - drmmode_output = xcalloc(sizeof(drmmode_output_private_rec), 1); + drmmode_output = calloc(sizeof(drmmode_output_private_rec), 1); if (!drmmode_output) { xf86OutputDestroy(output); drmModeFreeConnector(koutput); @@ -1276,7 +1276,7 @@ drmmode_output_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, int num) */ drmmode_output->private_data = NULL; if (koutput->connector_type == DRM_MODE_CONNECTOR_LVDS) { - drmmode_output->private_data = xcalloc( + drmmode_output->private_data = calloc( sizeof(struct fixed_panel_lvds), 1); if (!drmmode_output->private_data) xf86DrvMsg(scrn->scrnIndex, X_ERROR, diff --git a/src/i810_dga.c b/src/i810_dga.c index 3f530579..52a01b76 100644 --- a/src/i810_dga.c +++ b/src/i810_dga.c @@ -84,10 +84,10 @@ I810DGAInit(ScreenPtr pScreen) while (pMode) { - newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); + newmodes = realloc(modes, (num + 1) * sizeof(DGAModeRec)); if (!newmodes) { - xfree(modes); + free(modes); return FALSE; } modes = newmodes; diff --git a/src/i810_dri.c b/src/i810_dri.c index e566acf6..c4022423 100644 --- a/src/i810_dri.c +++ b/src/i810_dri.c @@ -172,25 +172,25 @@ I810InitVisualConfigs(ScreenPtr pScreen) numConfigs = 8; pConfigs = - (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig), + (__GLXvisualConfig *) calloc(sizeof(__GLXvisualConfig), numConfigs); if (!pConfigs) return FALSE; pI810Configs = - (I810ConfigPrivPtr) xcalloc(sizeof(I810ConfigPrivRec), + (I810ConfigPrivPtr) calloc(sizeof(I810ConfigPrivRec), numConfigs); if (!pI810Configs) { - xfree(pConfigs); + free(pConfigs); return FALSE; } pI810ConfigPtrs = - (I810ConfigPrivPtr *) xcalloc(sizeof(I810ConfigPrivPtr), + (I810ConfigPrivPtr *) calloc(sizeof(I810ConfigPrivPtr), numConfigs); if (!pI810ConfigPtrs) { - xfree(pConfigs); - xfree(pI810Configs); + free(pConfigs); + free(pI810Configs); return FALSE; } @@ -338,7 +338,7 @@ I810DRIScreenInit(ScreenPtr pScreen) if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) { pDRIInfo->busIdString = DRICreatePCIBusID(pI810->PciInfo); } else { - pDRIInfo->busIdString = xalloc(64); + pDRIInfo->busIdString = malloc(64); sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", ((pI810->PciInfo->domain << 8) | pI810->PciInfo->bus), pI810->PciInfo->dev, pI810->PciInfo->func @@ -370,7 +370,7 @@ I810DRIScreenInit(ScreenPtr pScreen) } pDRIInfo->SAREASize = SAREA_MAX; - if (!(pI810DRI = (I810DRIPtr) xcalloc(sizeof(I810DRIRec), 1))) { + if (!(pI810DRI = (I810DRIPtr) calloc(sizeof(I810DRIRec), 1))) { DRIDestroyInfoRec(pI810->pDRIInfo); pI810->pDRIInfo = NULL; return FALSE; @@ -399,7 +399,7 @@ I810DRIScreenInit(ScreenPtr pScreen) if (!DRIScreenInit(pScreen, pDRIInfo, &pI810->drmSubFD)) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRIScreenInit failed. Disabling DRI.\n"); - xfree(pDRIInfo->devPrivate); + free(pDRIInfo->devPrivate); pDRIInfo->devPrivate = NULL; DRIDestroyInfoRec(pI810->pDRIInfo); pI810->pDRIInfo = NULL; @@ -1055,16 +1055,16 @@ I810DRICloseScreen(ScreenPtr pScreen) if (pI810->pDRIInfo) { if (pI810->pDRIInfo->devPrivate) { - xfree(pI810->pDRIInfo->devPrivate); + free(pI810->pDRIInfo->devPrivate); pI810->pDRIInfo->devPrivate = NULL; } DRIDestroyInfoRec(pI810->pDRIInfo); pI810->pDRIInfo = NULL; } if (pI810->pVisualConfigs) - xfree(pI810->pVisualConfigs); + free(pI810->pVisualConfigs); if (pI810->pVisualConfigsPriv) - xfree(pI810->pVisualConfigsPriv); + free(pI810->pVisualConfigsPriv); } static Bool @@ -1202,12 +1202,12 @@ I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, if (nbox > 1) { /* Keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr) xalloc(sizeof(BoxRec) * nbox); + pboxNew1 = (BoxPtr) malloc(sizeof(BoxRec) * nbox); if (!pboxNew1) return; - pptNew1 = (DDXPointPtr) xalloc(sizeof(DDXPointRec) * nbox); + pptNew1 = (DDXPointPtr) malloc(sizeof(DDXPointRec) * nbox); if (!pptNew1) { - xfree(pboxNew1); + free(pboxNew1); return; } pboxBase = pboxNext = pbox + nbox - 1; @@ -1238,16 +1238,16 @@ I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, if (nbox > 1) { /*reverse orderof rects in each band */ - pboxNew2 = (BoxPtr) xalloc(sizeof(BoxRec) * nbox); - pptNew2 = (DDXPointPtr) xalloc(sizeof(DDXPointRec) * nbox); + pboxNew2 = (BoxPtr) malloc(sizeof(BoxRec) * nbox); + pptNew2 = (DDXPointPtr) malloc(sizeof(DDXPointRec) * nbox); if (!pboxNew2 || !pptNew2) { if (pptNew2) - xfree(pptNew2); + free(pptNew2); if (pboxNew2) - xfree(pboxNew2); + free(pboxNew2); if (pboxNew1) { - xfree(pptNew1); - xfree(pboxNew1); + free(pptNew1); + free(pboxNew1); } return; } @@ -1312,12 +1312,12 @@ I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, I810EmitFlush(pScrn); if (pboxNew2) { - xfree(pptNew2); - xfree(pboxNew2); + free(pptNew2); + free(pboxNew2); } if (pboxNew1) { - xfree(pptNew1); - xfree(pboxNew1); + free(pptNew1); + free(pboxNew1); } if (pI810->AccelInfoRec) diff --git a/src/i810_driver.c b/src/i810_driver.c index 68e45bb6..345854f2 100644 --- a/src/i810_driver.c +++ b/src/i810_driver.c @@ -364,7 +364,7 @@ I810FreeRec(ScrnInfoPtr pScrn) return; if (!pScrn->driverPrivate) return; - xfree(pScrn->driverPrivate); + free(pScrn->driverPrivate); pScrn->driverPrivate = NULL; } #endif @@ -618,7 +618,7 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) /* Process the options */ xf86CollectOptions(pScrn, NULL); - if (!(pI810->Options = xalloc(sizeof(I810Options)))) + if (!(pI810->Options = malloc(sizeof(I810Options)))) return FALSE; memcpy(pI810->Options, I810Options, sizeof(I810Options)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI810->Options); @@ -1914,7 +1914,7 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pI810 = I810PTR(pScrn); hwp = VGAHWPTR(pScrn); - pI810->LpRing = xcalloc(sizeof(I810RingBuffer),1); + pI810->LpRing = calloc(sizeof(I810RingBuffer),1); if (!pI810->LpRing) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not allocate lpring data structure.\n"); @@ -2326,13 +2326,13 @@ I810CloseScreen(int scrnIndex, ScreenPtr pScreen) vgaHWUnmapMem(pScrn); if (pI810->ScanlineColorExpandBuffers) { - xfree(pI810->ScanlineColorExpandBuffers); + free(pI810->ScanlineColorExpandBuffers); pI810->ScanlineColorExpandBuffers = NULL; } if (infoPtr) { if (infoPtr->ScanlineColorExpandBuffers) - xfree(infoPtr->ScanlineColorExpandBuffers); + free(infoPtr->ScanlineColorExpandBuffers); XAADestroyInfoRec(infoPtr); pI810->AccelInfoRec = NULL; } @@ -2353,7 +2353,7 @@ I810CloseScreen(int scrnIndex, ScreenPtr pScreen) */ xf86GARTCloseScreen(scrnIndex); - xfree(pI810->LpRing); + free(pI810->LpRing); pI810->LpRing = NULL; pScrn->vtSema = FALSE; diff --git a/src/i810_hwmc.c b/src/i810_hwmc.c index 1c3ffc99..724e1bea 100644 --- a/src/i810_hwmc.c +++ b/src/i810_hwmc.c @@ -230,7 +230,7 @@ void I810InitMC(ScreenPtr pScreen) * Set *num_priv to the number of 32bit words that make up the size of * of the data that priv will point to. * - * *priv = (long *) xcalloc (elements, sizeof(element)) + * *priv = (long *) calloc (elements, sizeof(element)) * *num_priv = (elements * sizeof(element)) >> 2; * **************************************************************************/ @@ -256,7 +256,7 @@ int I810XvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, return BadAlloc; } - *priv = xcalloc(1,sizeof(I810XvMCCreateContextRec)); + *priv = calloc(1,sizeof(I810XvMCCreateContextRec)); contextRec = (I810XvMCCreateContextRec *)*priv; if(!*priv) { @@ -268,7 +268,7 @@ int I810XvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, if(drmCreateContext(pI810->drmSubFD, &(contextRec->drmcontext) ) < 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I810XvMCCreateContext: Unable to create DRMContext!\n"); - xfree(*priv); + free(*priv); return BadAlloc; } @@ -295,7 +295,7 @@ int I810XvMCCreateSurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf, I810Ptr pI810 = I810PTR(pScrn); int i; - *priv = (long *)xcalloc(2,sizeof(long)); + *priv = (long *)calloc(2,sizeof(long)); if(!*priv) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -341,7 +341,7 @@ int I810XvMCCreateSubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSubp, I810Ptr pI810 = I810PTR(pScrn); int i; - *priv = (long *)xcalloc(1,sizeof(long)); + *priv = (long *)calloc(1,sizeof(long)); if(!*priv) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, diff --git a/src/i810_video.c b/src/i810_video.c index ee1a2326..85b5b65c 100644 --- a/src/i810_video.c +++ b/src/i810_video.c @@ -174,7 +174,7 @@ void I810InitVideo(ScreenPtr pScreen) adaptors = &newAdaptor; } else { newAdaptors = /* need to free this someplace */ - xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); if(newAdaptors) { memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); @@ -189,7 +189,7 @@ void I810InitVideo(ScreenPtr pScreen) xf86XVScreenInit(pScreen, adaptors, num_adaptors); if(newAdaptors) - xfree(newAdaptors); + free(newAdaptors); } /* *INDENT-OFF* */ @@ -383,7 +383,7 @@ I810SetupImageVideo(ScreenPtr pScreen) XF86VideoAdaptorPtr adapt; I810PortPrivPtr pPriv; - if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + sizeof(I810PortPrivRec) + sizeof(DevUnion)))) return NULL; @@ -1225,18 +1225,18 @@ I810AllocateSurface( surface->width = w; surface->height = h; - if(!(surface->pitches = xalloc(sizeof(int)))) { + if(!(surface->pitches = malloc(sizeof(int)))) { xf86FreeOffscreenLinear(linear); return BadAlloc; } - if(!(surface->offsets = xalloc(sizeof(int)))) { - xfree(surface->pitches); + if(!(surface->offsets = malloc(sizeof(int)))) { + free(surface->pitches); xf86FreeOffscreenLinear(linear); return BadAlloc; } - if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { - xfree(surface->pitches); - xfree(surface->offsets); + if(!(pPriv = malloc(sizeof(OffscreenPrivRec)))) { + free(surface->pitches); + free(surface->offsets); xf86FreeOffscreenLinear(linear); return BadAlloc; } @@ -1286,9 +1286,9 @@ I810FreeSurface( I810StopSurface(surface); } xf86FreeOffscreenLinear(pPriv->linear); - xfree(surface->pitches); - xfree(surface->offsets); - xfree(surface->devPrivate.ptr); + free(surface->pitches); + free(surface->offsets); + free(surface->devPrivate.ptr); return Success; } @@ -1401,7 +1401,7 @@ I810InitOffscreenImages(ScreenPtr pScreen) XF86OffscreenImagePtr offscreenImages; /* need to free this someplace */ - if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) { + if(!(offscreenImages = malloc(sizeof(XF86OffscreenImageRec)))) { return; } diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c index cafcf8b3..2107acbd 100644 --- a/src/i830_batchbuffer.c +++ b/src/i830_batchbuffer.c @@ -140,7 +140,7 @@ void intel_batch_teardown(ScrnInfoPtr scrn) dri_bo_unreference(entry->bo); list_del(&entry->in_flight); - xfree(entry); + free(entry); } } @@ -254,7 +254,7 @@ void intel_batch_submit(ScrnInfoPtr scrn) dri_bo_unreference(entry->bo); list_del(&entry->in_flight); - xfree(entry); + free(entry); } /* Save a ref to the last batch emitted, which we use for syncing diff --git a/src/i830_bios.c b/src/i830_bios.c index b7262c79..da77cd43 100644 --- a/src/i830_bios.c +++ b/src/i830_bios.c @@ -352,7 +352,7 @@ int i830_bios_init(ScrnInfoPtr scrn) "libpciaccess reported 0 rom size, guessing %dkB\n", size / 1024); } - bios = xalloc(size); + bios = malloc(size); if (bios == NULL) return -1; @@ -361,7 +361,7 @@ int i830_bios_init(ScrnInfoPtr scrn) xf86DrvMsg(scrn->scrnIndex, X_WARNING, "libpciaccess failed to read %dkB video BIOS: %s\n", size / 1024, strerror(-ret)); - xfree(bios); + free(bios); return -1; } @@ -369,7 +369,7 @@ int i830_bios_init(ScrnInfoPtr scrn) if (vbt_off >= size) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Bad VBT offset: 0x%x\n", vbt_off); - xfree(bios); + free(bios); return -1; } @@ -377,7 +377,7 @@ int i830_bios_init(ScrnInfoPtr scrn) if (memcmp(vbt->signature, "$VBT", 4) != 0) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Bad VBT signature\n"); - xfree(bios); + free(bios); return -1; } @@ -390,7 +390,7 @@ int i830_bios_init(ScrnInfoPtr scrn) parse_driver_feature(intel, bdb); parse_sdvo_mapping(scrn, bdb); - xfree(bios); + free(bios); return 0; } diff --git a/src/i830_crt.c b/src/i830_crt.c index 26c9d412..b18834e7 100644 --- a/src/i830_crt.c +++ b/src/i830_crt.c @@ -500,7 +500,7 @@ static void i830_crt_destroy (xf86OutputPtr output) { if (output->driver_private) - xfree (output->driver_private); + free (output->driver_private); } #ifdef RANDR_GET_CRTC_INTERFACE @@ -537,7 +537,7 @@ i830_get_edid(xf86OutputPtr output, int gpio_reg, char *gpio_str) xf86DestroyI2CBusRec(intel_output->pDDCBus, TRUE, TRUE); intel_output->pDDCBus = NULL; if (edid_mon) { - xfree(edid_mon); + free(edid_mon); edid_mon = NULL; } } diff --git a/src/i830_display.c b/src/i830_display.c index 5e10fa9d..bd5bf120 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -3194,7 +3194,7 @@ i830_crtc_mode_get(ScrnInfoPtr scrn, xf86CrtcPtr crtc) int vtot = INREG((pipe == 0) ? VTOTAL_A : VTOTAL_B); int vsync = INREG((pipe == 0) ? VSYNC_A : VSYNC_B); - mode = xcalloc(1, sizeof(DisplayModeRec)); + mode = calloc(1, sizeof(DisplayModeRec)); if (mode == NULL) return NULL; diff --git a/src/i830_dri.c b/src/i830_dri.c index ef128a44..9b33fe28 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -94,12 +94,12 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments, I830DRI2BufferPrivatePtr privates; PixmapPtr pixmap, pDepthPixmap; - buffers = xcalloc(count, sizeof *buffers); + buffers = calloc(count, sizeof *buffers); if (buffers == NULL) return NULL; - privates = xcalloc(count, sizeof *privates); + privates = calloc(count, sizeof *privates); if (privates == NULL) { - xfree(buffers); + free(buffers); return NULL; } @@ -175,12 +175,12 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, I830DRI2BufferPrivatePtr privates; PixmapPtr pixmap; - buffer = xcalloc(1, sizeof *buffer); + buffer = calloc(1, sizeof *buffer); if (buffer == NULL) return NULL; - privates = xcalloc(1, sizeof *privates); + privates = calloc(1, sizeof *privates); if (privates == NULL) { - xfree(buffer); + free(buffer); return NULL; } @@ -216,8 +216,8 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, drawable->depth, hint); if (pixmap == NULL) { - xfree(privates); - xfree(buffer); + free(privates); + free(buffer); return NULL; } @@ -237,8 +237,8 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, if (bo == NULL || dri_bo_flink(bo, &buffer->name) != 0) { /* failed to name buffer */ screen->DestroyPixmap(pixmap); - xfree(privates); - xfree(buffer); + free(privates); + free(buffer); return NULL; } @@ -262,8 +262,8 @@ I830DRI2DestroyBuffers(DrawablePtr drawable, DRI2BufferPtr buffers, int count) } if (buffers) { - xfree(buffers[0].driverPrivate); - xfree(buffers); + free(buffers[0].driverPrivate); + free(buffers); } } @@ -278,8 +278,8 @@ static void I830DRI2DestroyBuffer(DrawablePtr drawable, DRI2Buffer2Ptr buffer) screen->DestroyPixmap(private->pixmap); - xfree(private); - xfree(buffer); + free(private); + free(buffer); } } } @@ -504,7 +504,7 @@ void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec, if (status != Success) { I830DRI2DestroyBuffer(NULL, event->front); I830DRI2DestroyBuffer(NULL, event->back); - xfree(event); + free(event); return; } @@ -552,7 +552,7 @@ void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec, I830DRI2DestroyBuffer(drawable, event->front); I830DRI2DestroyBuffer(drawable, event->back); - xfree(event); + free(event); } void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec, @@ -567,7 +567,7 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec, status = dixLookupDrawable(&drawable, flip->drawable_id, serverClient, M_ANY, DixWriteAccess); if (status != Success) { - xfree(flip); + free(flip); return; } @@ -588,7 +588,7 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec, break; } - xfree(flip); + free(flip); } /* @@ -633,7 +633,7 @@ I830DRI2ScheduleSwap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front, divisor &= 0xffffffff; remainder &= 0xffffffff; - swap_info = xcalloc(1, sizeof(DRI2FrameEventRec)); + swap_info = calloc(1, sizeof(DRI2FrameEventRec)); /* Drawable not displayed... just complete the swap */ if (pipe == -1 || !swap_info) @@ -773,7 +773,7 @@ blit_fallback: if (swap_info) { I830DRI2DestroyBuffer(draw, swap_info->front); I830DRI2DestroyBuffer(draw, swap_info->back); - xfree(swap_info); + free(swap_info); } *target_msc = 0; /* offscreen, so zero out target vblank count */ return TRUE; @@ -845,7 +845,7 @@ I830DRI2ScheduleWaitMSC(ClientPtr client, DrawablePtr draw, CARD64 target_msc, if (pipe == -1) goto out_complete; - wait_info = xcalloc(1, sizeof(DRI2FrameEventRec)); + wait_info = calloc(1, sizeof(DRI2FrameEventRec)); if (!wait_info) goto out_complete; diff --git a/src/i830_driver.c b/src/i830_driver.c index d876a93e..87d7d2ef 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -255,16 +255,12 @@ static Bool I830GetRec(ScrnInfoPtr scrn) static void I830FreeRec(ScrnInfoPtr scrn) { - intel_screen_private *intel; - if (!scrn) return; if (!scrn->driverPrivate) return; - intel = intel_get_screen_private(scrn); - - xfree(scrn->driverPrivate); + free(scrn->driverPrivate); scrn->driverPrivate = NULL; } @@ -985,7 +981,7 @@ static Bool i830_kernel_mode_enabled(ScrnInfoPtr scrn) /* Be nice to the user and load fbcon too */ if (!ret) (void)xf86LoadKernelModule("fbcon"); - xfree(busIdString); + free(busIdString); if (ret) return FALSE; @@ -1255,7 +1251,7 @@ static Bool I830GetEarlyOptions(ScrnInfoPtr scrn) /* Process the options */ xf86CollectOptions(scrn, NULL); - if (!(intel->Options = xalloc(sizeof(I830Options)))) + if (!(intel->Options = malloc(sizeof(I830Options)))) return FALSE; memcpy(intel->Options, I830Options, sizeof(I830Options)); xf86ProcessOptions(scrn->scrnIndex, scrn->options, intel->Options); @@ -1425,11 +1421,11 @@ static Bool i830_open_drm_master(ScrnInfoPtr scrn) xf86DrvMsg(scrn->scrnIndex, X_ERROR, "[drm] Failed to open DRM device for %s: %s\n", busid, strerror(errno)); - xfree(busid); + free(busid); return FALSE; } - xfree(busid); + free(busid); /* Check that what we opened was a master or a master-capable FD, * by setting the version of the interface we'll use to talk to it. @@ -3023,7 +3019,7 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen) if (intel->uxa_driver) { uxa_driver_fini(screen); - xfree(intel->uxa_driver); + free(intel->uxa_driver); intel->uxa_driver = NULL; } if (intel->front_buffer) { diff --git a/src/i830_dvo.c b/src/i830_dvo.c index 3deb254b..bccbe7b0 100644 --- a/src/i830_dvo.c +++ b/src/i830_dvo.c @@ -302,7 +302,7 @@ i830_dvo_destroy (xf86OutputPtr output) xf86DestroyI2CBusRec (intel_output->pI2CBus, TRUE, TRUE); if (intel_output->pDDCBus) xf86DestroyI2CBusRec (intel_output->pDDCBus, TRUE, TRUE); - xfree (intel_output); + free (intel_output); } } @@ -407,7 +407,7 @@ i830_dvo_init(ScrnInfoPtr scrn) /* Set up the DDC bus */ ret = I830I2CInit(scrn, &intel_output->pDDCBus, GPIOD, "DVODDC_D"); if (!ret) { - xfree(intel_output); + free(intel_output); return; } @@ -482,7 +482,7 @@ i830_dvo_init(ScrnInfoPtr scrn) if (output == NULL) { xf86DestroyI2CBusRec(pI2CBus, TRUE, TRUE); xf86DestroyI2CBusRec(intel_output->pDDCBus, TRUE, TRUE); - xfree(intel_output); + free(intel_output); xf86UnloadSubModule(drv->modhandle); return; } @@ -517,5 +517,5 @@ i830_dvo_init(ScrnInfoPtr scrn) if (pI2CBus != NULL) xf86DestroyI2CBusRec(pI2CBus, TRUE, TRUE); xf86DestroyI2CBusRec(intel_output->pDDCBus, TRUE, TRUE); - xfree(intel_output); + free(intel_output); } diff --git a/src/i830_hdmi.c b/src/i830_hdmi.c index 3b04b0f5..41b264ec 100644 --- a/src/i830_hdmi.c +++ b/src/i830_hdmi.c @@ -231,7 +231,7 @@ i830_hdmi_detect(xf86OutputPtr output) dev_priv->has_hdmi_sink ? "HDMI" : "DVI", (dev_priv->output_reg == SDVOB) ? 1 : 2); - xfree(edid_mon); + free(edid_mon); return status; } @@ -242,7 +242,7 @@ i830_hdmi_destroy (xf86OutputPtr output) if (intel_output != NULL) { xf86DestroyI2CBusRec(intel_output->pDDCBus, FALSE, FALSE); - xfree(intel_output); + free(intel_output); } } diff --git a/src/i830_hwmc.c b/src/i830_hwmc.c index 850bf876..9aa0af33 100644 --- a/src/i830_hwmc.c +++ b/src/i830_hwmc.c @@ -62,7 +62,7 @@ static int create_context(ScrnInfoPtr scrn, XvMCContextPtr pContext, intel_screen_private *intel = intel_get_screen_private(scrn); struct intel_xvmc_hw_context *contextRec; - *priv = xcalloc(1, sizeof(struct intel_xvmc_hw_context)); + *priv = calloc(1, sizeof(struct intel_xvmc_hw_context)); contextRec = (struct intel_xvmc_hw_context *) *priv; if (!contextRec) { *num_priv = 0; @@ -207,7 +207,7 @@ Bool intel_xvmc_adaptor_init(ScreenPtr pScreen) return FALSE; } - pAdapt = xcalloc(1, sizeof(XF86MCAdaptorRec)); + pAdapt = calloc(1, sizeof(XF86MCAdaptorRec)); if (!pAdapt) { ErrorF("Allocation error.\n"); return FALSE; diff --git a/src/i830_lvds.c b/src/i830_lvds.c index 7af63ffe..651916cf 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -1084,7 +1084,7 @@ i830_lvds_get_modes(xf86OutputPtr output) if (!output->MonInfo) { - edid_mon = xcalloc (1, sizeof (xf86Monitor)); + edid_mon = calloc (1, sizeof (xf86Monitor)); if (edid_mon) { struct detailed_monitor_section *det_mon = edid_mon->det_mon; @@ -1135,7 +1135,7 @@ i830_lvds_destroy (xf86OutputPtr output) xf86DeleteMode (&intel->lvds_fixed_mode, intel->lvds_fixed_mode); if (intel_output) - xfree (intel_output); + free (intel_output); } #ifdef RANDR_12_INTERFACE diff --git a/src/i830_memory.c b/src/i830_memory.c index f26ec6dd..0e523b7c 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -276,8 +276,8 @@ void i830_free_memory(ScrnInfoPtr scrn, i830_memory * mem) if (mem->next) mem->next->prev = mem->prev; } - xfree(mem->name); - xfree(mem); + free(mem->name); + free(mem); return; } /* Disconnect from the list of allocations */ @@ -291,8 +291,8 @@ void i830_free_memory(ScrnInfoPtr scrn, i830_memory * mem) mem->key = -1; } - xfree(mem->name); - xfree(mem); + free(mem->name); + free(mem); } /* Resets the state of the aperture allocator, freeing all memory that had @@ -349,25 +349,25 @@ Bool i830_allocator_init(ScrnInfoPtr scrn, unsigned long size) i830_memory *start, *end; struct drm_i915_setparam sp; - start = xcalloc(1, sizeof(*start)); + start = calloc(1, sizeof(*start)); if (start == NULL) return FALSE; start->name = xstrdup("start marker"); if (start->name == NULL) { - xfree(start); + free(start); return FALSE; } - end = xcalloc(1, sizeof(*end)); + end = calloc(1, sizeof(*end)); if (end == NULL) { - xfree(start->name); - xfree(start); + free(start->name); + free(start); return FALSE; } end->name = xstrdup("end marker"); if (end->name == NULL) { - xfree(start->name); - xfree(start); - xfree(end); + free(start->name); + free(start); + free(end); return FALSE; } @@ -564,7 +564,7 @@ i830_allocate_aperture(ScrnInfoPtr scrn, const char *name, unsigned long size, intel_screen_private *intel = intel_get_screen_private(scrn); i830_memory *mem, *scan; - mem = xcalloc(1, sizeof(*mem)); + mem = calloc(1, sizeof(*mem)); if (mem == NULL) return NULL; @@ -573,7 +573,7 @@ i830_allocate_aperture(ScrnInfoPtr scrn, const char *name, unsigned long size, mem->name = xstrdup(name); if (mem->name == NULL) { - xfree(mem); + free(mem); return NULL; } /* Only allocate page-sized increments. */ @@ -624,8 +624,8 @@ i830_allocate_aperture(ScrnInfoPtr scrn, const char *name, unsigned long size, } if (scan->next == NULL) { /* Reached the end of the list, and didn't find space */ - xfree(mem->name); - xfree(mem); + free(mem->name); + free(mem); return NULL; } /* Insert new allocation into the list */ @@ -697,21 +697,21 @@ static i830_memory *i830_allocate_memory_bo(ScrnInfoPtr scrn, const char *name, size = ALIGN(size, GTT_PAGE_SIZE); align = i830_get_fence_alignment(intel, size); - mem = xcalloc(1, sizeof(*mem)); + mem = calloc(1, sizeof(*mem)); if (mem == NULL) return NULL; mem->name = xstrdup(name); if (mem->name == NULL) { - xfree(mem); + free(mem); return NULL; } mem->bo = dri_bo_alloc(intel->bufmgr, name, size, align); if (!mem->bo) { - xfree(mem->name); - xfree(mem); + free(mem->name); + free(mem); return NULL; } @@ -755,8 +755,8 @@ static i830_memory *i830_allocate_memory_bo(ScrnInfoPtr scrn, const char *name, if (scrn->vtSema || intel->use_drm_mode) { if (!i830_bind_memory(scrn, mem)) { dri_bo_unreference (mem->bo); - xfree(mem->name); - xfree(mem); + free(mem->name); + free(mem); return NULL; } } diff --git a/src/i830_quirks.c b/src/i830_quirks.c index 1d9b681c..28585693 100644 --- a/src/i830_quirks.c +++ b/src/i830_quirks.c @@ -73,7 +73,7 @@ static void i830_dmi_store_##field(void) \ int ret;\ f = fopen(DMIID_FILE(field), "r");\ if (f == NULL) {\ - xfree(i830_dmi_data[field]); i830_dmi_data[field] = NULL;\ + free(i830_dmi_data[field]); i830_dmi_data[field] = NULL;\ return;\ }\ ret = fread(i830_dmi_data[field], 64, 1, f); \ @@ -104,11 +104,11 @@ static void i830_dmi_scan(void) int i; for (i = 0; i < dmi_data_max; i++) { - i830_dmi_data[i] = xcalloc(64, sizeof(char)); + i830_dmi_data[i] = calloc(64, sizeof(char)); if (!i830_dmi_data[i]) { int j; for (j = 0; j < i; j++) { - xfree(i830_dmi_data[j]); + free(i830_dmi_data[j]); i830_dmi_data[i] = NULL; } return; @@ -426,5 +426,5 @@ void i830_fixup_devices(ScrnInfoPtr scrn) for (i = 0; i < dmi_data_max; i++) if (i830_dmi_data[i]) - xfree(i830_dmi_data[i]); + free(i830_dmi_data[i]); } diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index 393804ea..a9275afa 100644 --- a/src/i830_sdvo.c +++ b/src/i830_sdvo.c @@ -1723,7 +1723,7 @@ i830_sdvo_output_setup (xf86OutputPtr output, uint16_t flag) } /* if exist origin name it will be freed in xf86OutputRename() */ - dev_priv->name = xalloc(strlen(name_prefix) + strlen(name_suffix) + 1); + dev_priv->name = malloc(strlen(name_prefix) + strlen(name_suffix) + 1); strcpy (dev_priv->name, name_prefix); strcat (dev_priv->name, name_suffix); @@ -1740,11 +1740,11 @@ i830_sdvo_output_setup (xf86OutputPtr output, uint16_t flag) if (output->randr_output) { int nameLength = strlen(dev_priv->name); RROutputPtr randr_output = output->randr_output; - char *name = xalloc(nameLength + 1); + char *name = malloc(nameLength + 1); if (name) { if (randr_output->name != (char *) (randr_output + 1)) - xfree(randr_output->name); + free(randr_output->name); randr_output->name = name; randr_output->nameLength = nameLength; memcpy(randr_output->name, dev_priv->name, nameLength); @@ -1825,10 +1825,10 @@ i830_sdvo_detect(xf86OutputPtr output) /* Check EDID in DVI-I case */ edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus); if (edid_mon && !DIGITAL(edid_mon->features.input_type)) { - xfree(edid_mon); + free(edid_mon); return XF86OutputStatusDisconnected; } - xfree(edid_mon); + free(edid_mon); } return XF86OutputStatusConnected; } @@ -1898,7 +1898,7 @@ i830_sdvo_get_tv_mode(DisplayModePtr *head, int width, int height, { DisplayModePtr mode; - mode = xcalloc(1, sizeof(*mode)); + mode = calloc(1, sizeof(*mode)); if (mode == NULL) return; @@ -2020,14 +2020,14 @@ i830_sdvo_destroy (xf86OutputPtr output) RROutputPtr randr_output = output->randr_output; if (randr_output->name && randr_output->name != (char *) (randr_output + 1)) - xfree(randr_output->name); + free(randr_output->name); } if (dev_priv->sdvo_lvds_fixed_mode) xf86DeleteMode(&dev_priv->sdvo_lvds_fixed_mode, dev_priv->sdvo_lvds_fixed_mode); - xfree (intel_output); + free (intel_output); } } diff --git a/src/i830_tv.c b/src/i830_tv.c index 8f37f3c8..71fd7df2 100644 --- a/src/i830_tv.c +++ b/src/i830_tv.c @@ -1570,7 +1570,7 @@ static void i830_tv_destroy (xf86OutputPtr output) { if (output->driver_private) - xfree (output->driver_private); + free (output->driver_private); } #ifdef RANDR_12_INTERFACE @@ -1807,16 +1807,16 @@ i830_tv_set_property(xf86OutputPtr output, Atom property, memcpy (&atom, value->data, 4); name = NameForAtom (atom); - val = xalloc (strlen (name) + 1); + val = malloc (strlen (name) + 1); if (!val) return FALSE; strcpy (val, name); if (!i830_tv_mode_lookup (val)) { - xfree (val); + free (val); return FALSE; } - xfree (dev_priv->tv_format); + free (dev_priv->tv_format); dev_priv->tv_format = val; if (intel->starting || output->crtc == NULL) diff --git a/src/i830_uxa.c b/src/i830_uxa.c index ef0f7ee1..6ac2f431 100644 --- a/src/i830_uxa.c +++ b/src/i830_uxa.c @@ -617,7 +617,7 @@ void i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo * bo) int ret; if (priv == NULL) { - priv = xcalloc(1, sizeof (struct intel_pixmap)); + priv = calloc(1, sizeof (struct intel_pixmap)); if (priv == NULL) goto BAIL; @@ -638,7 +638,7 @@ void i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo * bo) } } else { if (priv != NULL) { - xfree(priv); + free(priv); priv = NULL; } } @@ -1000,7 +1000,7 @@ i830_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth, } } - priv = xcalloc(1, sizeof (struct intel_pixmap)); + priv = calloc(1, sizeof (struct intel_pixmap)); if (priv == NULL) { fbDestroyPixmap(pixmap); return NullPixmap; @@ -1014,7 +1014,7 @@ i830_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth, "pixmap", size, 0); if (!priv->bo) { - xfree(priv); + free(priv); fbDestroyPixmap(pixmap); if (errno == EFBIG) return fbCreatePixmap(screen, w, h, depth, usage); @@ -1133,7 +1133,7 @@ Bool i830_uxa_init(ScreenPtr screen) if (!uxa_driver_init(screen, intel->uxa_driver)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "UXA initialization failed\n"); - xfree(intel->uxa_driver); + free(intel->uxa_driver); return FALSE; } diff --git a/src/i830_video.c b/src/i830_video.c index 23163684..92076556 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -557,7 +557,7 @@ void I830InitVideo(ScreenPtr screen) * adaptors. */ newAdaptors = - xalloc((num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr *)); + malloc((num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr *)); if (newAdaptors == NULL) return; @@ -619,7 +619,7 @@ void I830InitVideo(ScreenPtr screen) if (texturedAdaptor) intel_xvmc_adaptor_init(screen); #endif - xfree(adaptors); + free(adaptors); } static void @@ -818,7 +818,7 @@ static XF86VideoAdaptorPtr I830SetupImageVideoOverlay(ScreenPtr screen) OVERLAY_DEBUG("I830SetupImageVideoOverlay\n"); - if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + if (!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + sizeof(intel_adaptor_private) + sizeof(DevUnion)))) return NULL; @@ -950,16 +950,16 @@ static XF86VideoAdaptorPtr I830SetupImageVideoTextured(ScreenPtr screen) nAttributes = NUM_TEXTURED_ATTRIBUTES; - adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec)); - adaptor_privs = xcalloc(nports, sizeof(intel_adaptor_private)); - devUnions = xcalloc(nports, sizeof(DevUnion)); - attrs = xcalloc(nAttributes, sizeof(XF86AttributeRec)); + adapt = calloc(1, sizeof(XF86VideoAdaptorRec)); + adaptor_privs = calloc(nports, sizeof(intel_adaptor_private)); + devUnions = calloc(nports, sizeof(DevUnion)); + attrs = calloc(nAttributes, sizeof(XF86AttributeRec)); if (adapt == NULL || adaptor_privs == NULL || devUnions == NULL || attrs == NULL) { - xfree(adapt); - xfree(adaptor_privs); - xfree(devUnions); - xfree(attrs); + free(adapt); + free(adaptor_privs); + free(devUnions); + free(attrs); return NULL; } |