Commit 5413c5ec authored by Mihai Moldovan's avatar Mihai Moldovan

misc nx-X11/programs/Xserver/{composite,dix,randr}/: switch to using…

misc nx-X11/programs/Xserver/{composite,dix,randr}/: switch to using reallocarray, since it has been ported now.
parent cd1dcdb2
......@@ -226,13 +226,8 @@ compRegisterAlternateVisuals(CompScreenPtr cs, VisualID * vids, int nVisuals)
{
VisualID *p;
#ifndef NXAGENT_SERVER
p = reallocarray(cs->alternateVisuals,
cs->numAlternateVisuals + nVisuals, sizeof(VisualID));
#else
p = realloc(cs->alternateVisuals,
sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
#endif
if (p == NULL)
return FALSE;
......@@ -261,13 +256,8 @@ CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen,
CompScreenPtr cs = GetCompScreen(pScreen);
CompImplicitRedirectException *p;
#ifndef NXAGENT_SERVER
p = reallocarray(cs->implicitRedirectExceptions,
cs->numImplicitRedirectExceptions + 1, sizeof(p[0]));
#else
p = realloc(cs->implicitRedirectExceptions,
sizeof(p[0]) * (cs->numImplicitRedirectExceptions + 1));
#endif
if (p == NULL)
return FALSE;
......
......@@ -2721,13 +2721,8 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
first_new_vid = depth->numVids;
first_new_visual = pScreen->numVisuals;
#if 0 /* !defined(NXAGENT_SERVER) */
vids = reallocarray(depth->vids, depth->numVids + new_visual_count,
sizeof(XID));
#else
vids = realloc(depth->vids, sizeof(XID) *
(depth->numVids + new_visual_count));
#endif
if (!vids)
return FALSE;
......@@ -2735,11 +2730,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
depth->vids = vids;
numVisuals = pScreen->numVisuals + new_visual_count;
#if 0 /* !defined(NXAGENT_SERVER) */
visuals = reallocarray(pScreen->visuals, numVisuals, sizeof(VisualRec));
#else
visuals = realloc(pScreen->visuals, sizeof(VisualRec) * numVisuals);
#endif
if (!visuals) {
return FALSE;
}
......
......@@ -90,13 +90,8 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
/* make space for the crtc pointer */
if (pScrPriv->numCrtcs)
#ifndef NXAGENT_SERVER
crtcs = reallocarray(pScrPriv->crtcs,
pScrPriv->numCrtcs + 1, sizeof(RRCrtcPtr));
#else /* !defined(NXAGENT_SERVER) */
crtcs = realloc(pScrPriv->crtcs,
(pScrPriv->numCrtcs + 1) * sizeof(RRCrtcPtr));
#endif /* !defined(NXAGENT_SERVER) */
else
crtcs = malloc(sizeof(RRCrtcPtr));
if (!crtcs)
......@@ -206,13 +201,8 @@ RRCrtcNotify(RRCrtcPtr crtc,
if (numOutputs) {
if (crtc->numOutputs)
#ifndef NXAGENT_SERVER
newoutputs = reallocarray(crtc->outputs,
numOutputs, sizeof(RROutputPtr));
#else /* !defined(NXAGENT_SERVER) */
newoutputs = realloc(crtc->outputs,
numOutputs * sizeof(RROutputPtr));
#endif /* !defined(NXAGENT_SERVER) */
else
#ifndef NXAGENT_SERVER
newoutputs = xallocarray(numOutputs, sizeof(RROutputPtr));
......
......@@ -55,13 +55,8 @@ RROldModeAdd(RROutputPtr output, RRScreenSizePtr size, int refresh)
}
if (output->numModes)
#ifndef NXAGENT_SERVER
modes = reallocarray(output->modes,
output->numModes + 1, sizeof(RRModePtr));
#else /* !defined(NXAGENT_SERVER) */
modes = realloc(output->modes,
(output->numModes + 1) * sizeof(RRModePtr));
#endif /* !defined(NXAGENT_SERVER) */
else
modes = malloc(sizeof(RRModePtr));
if (!modes) {
......@@ -271,13 +266,8 @@ RRRegisterSize(ScreenPtr pScreen,
for (i = 0; i < pScrPriv->nSizes; i++)
if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i]))
return &pScrPriv->pSizes[i];
#ifndef NXAGENT_SERVER
pNew = reallocarray(pScrPriv->pSizes,
pScrPriv->nSizes + 1, sizeof(RRScreenSize));
#else /* !defined(NXAGENT_SERVER) */
pNew = realloc(pScrPriv->pSizes,
(pScrPriv->nSizes + 1) * sizeof(RRScreenSize));
#endif /* !defined(NXAGENT_SERVER) */
if (!pNew)
return 0;
pNew[pScrPriv->nSizes++] = tmp;
......@@ -299,11 +289,7 @@ RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate)
if (pSize->pRates[i].rate == rate)
return TRUE;
#ifndef NXAGENT_SERVER
pNew = reallocarray(pSize->pRates, pSize->nRates + 1, sizeof(RRScreenRate));
#else /* !defined(NXAGENT_SERVER) */
pNew = realloc(pSize->pRates, (pSize->nRates + 1) * sizeof(RRScreenRate));
#endif /* !defined(NXAGENT_SERVER) */
if (!pNew)
return FALSE;
pRate = &pNew[pSize->nRates++];
......
......@@ -104,11 +104,7 @@ RRModeCreate(xRRModeInfo * modeInfo, const char *name, ScreenPtr userScreen)
mode->userScreen = userScreen;
if (num_modes)
#ifndef NXAGENT_SERVER
newModes = reallocarray(modes, num_modes + 1, sizeof(RRModePtr));
#else /* !defined(NXAGENT_SERVER) */
newModes = realloc(modes, (num_modes + 1) * sizeof(RRModePtr));
#endif /* !defined(NXAGENT_SERVER) */
else
newModes = malloc(sizeof(RRModePtr));
......
......@@ -507,14 +507,9 @@ RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor)
* needs to not have any side-effects on failure
*/
if (pScrPriv->numMonitors)
#ifndef NXAGENT_SERVER
monitors = reallocarray(pScrPriv->monitors,
pScrPriv->numMonitors + 1,
sizeof(RRMonitorPtr));
#else /* !defined(NXAGENT_SERVER) */
monitors = realloc(pScrPriv->monitors,
(pScrPriv->numMonitors + 1) * sizeof(RRMonitorPtr));
#endif /* !defined(NXAGENT_SERVER) */
else
monitors = malloc(sizeof(RRMonitorPtr));
......
......@@ -75,13 +75,8 @@ RROutputCreate(ScreenPtr pScreen,
pScrPriv = rrGetScrPriv(pScreen);
if (pScrPriv->numOutputs)
#ifndef NXAGENT_SERVER
outputs = reallocarray(pScrPriv->outputs,
pScrPriv->numOutputs + 1, sizeof(RROutputPtr));
#else /* !defined(NXAGENT_SERVER) */
outputs = realloc(pScrPriv->outputs,
(pScrPriv->numOutputs + 1) * sizeof(RROutputPtr));
#endif /* !defined(NXAGENT_SERVER) */
else
outputs = malloc(sizeof(RROutputPtr));
if (!outputs)
......@@ -228,13 +223,8 @@ RROutputAddUserMode(RROutputPtr output, RRModePtr mode)
return BadMatch;
if (output->userModes)
#ifndef NXAGENT_SERVER
newModes = reallocarray(output->userModes,
output->numUserModes + 1, sizeof(RRModePtr));
#else /* !defined(NXAGENT_SERVER) */
newModes = realloc(output->userModes,
(output->numUserModes + 1) * sizeof(RRModePtr));
#endif /* !defined(NXAGENT_SERVER) */
else
newModes = malloc(sizeof(RRModePtr));
if (!newModes)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment