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) ...@@ -226,13 +226,8 @@ compRegisterAlternateVisuals(CompScreenPtr cs, VisualID * vids, int nVisuals)
{ {
VisualID *p; VisualID *p;
#ifndef NXAGENT_SERVER
p = reallocarray(cs->alternateVisuals, p = reallocarray(cs->alternateVisuals,
cs->numAlternateVisuals + nVisuals, sizeof(VisualID)); cs->numAlternateVisuals + nVisuals, sizeof(VisualID));
#else
p = realloc(cs->alternateVisuals,
sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
#endif
if (p == NULL) if (p == NULL)
return FALSE; return FALSE;
...@@ -261,13 +256,8 @@ CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen, ...@@ -261,13 +256,8 @@ CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen,
CompScreenPtr cs = GetCompScreen(pScreen); CompScreenPtr cs = GetCompScreen(pScreen);
CompImplicitRedirectException *p; CompImplicitRedirectException *p;
#ifndef NXAGENT_SERVER
p = reallocarray(cs->implicitRedirectExceptions, p = reallocarray(cs->implicitRedirectExceptions,
cs->numImplicitRedirectExceptions + 1, sizeof(p[0])); cs->numImplicitRedirectExceptions + 1, sizeof(p[0]));
#else
p = realloc(cs->implicitRedirectExceptions,
sizeof(p[0]) * (cs->numImplicitRedirectExceptions + 1));
#endif
if (p == NULL) if (p == NULL)
return FALSE; return FALSE;
......
...@@ -2721,13 +2721,8 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth) ...@@ -2721,13 +2721,8 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
first_new_vid = depth->numVids; first_new_vid = depth->numVids;
first_new_visual = pScreen->numVisuals; first_new_visual = pScreen->numVisuals;
#if 0 /* !defined(NXAGENT_SERVER) */
vids = reallocarray(depth->vids, depth->numVids + new_visual_count, vids = reallocarray(depth->vids, depth->numVids + new_visual_count,
sizeof(XID)); sizeof(XID));
#else
vids = realloc(depth->vids, sizeof(XID) *
(depth->numVids + new_visual_count));
#endif
if (!vids) if (!vids)
return FALSE; return FALSE;
...@@ -2735,11 +2730,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth) ...@@ -2735,11 +2730,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
depth->vids = vids; depth->vids = vids;
numVisuals = pScreen->numVisuals + new_visual_count; numVisuals = pScreen->numVisuals + new_visual_count;
#if 0 /* !defined(NXAGENT_SERVER) */
visuals = reallocarray(pScreen->visuals, numVisuals, sizeof(VisualRec)); visuals = reallocarray(pScreen->visuals, numVisuals, sizeof(VisualRec));
#else
visuals = realloc(pScreen->visuals, sizeof(VisualRec) * numVisuals);
#endif
if (!visuals) { if (!visuals) {
return FALSE; return FALSE;
} }
......
...@@ -90,13 +90,8 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate) ...@@ -90,13 +90,8 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
/* make space for the crtc pointer */ /* make space for the crtc pointer */
if (pScrPriv->numCrtcs) if (pScrPriv->numCrtcs)
#ifndef NXAGENT_SERVER
crtcs = reallocarray(pScrPriv->crtcs, crtcs = reallocarray(pScrPriv->crtcs,
pScrPriv->numCrtcs + 1, sizeof(RRCrtcPtr)); pScrPriv->numCrtcs + 1, sizeof(RRCrtcPtr));
#else /* !defined(NXAGENT_SERVER) */
crtcs = realloc(pScrPriv->crtcs,
(pScrPriv->numCrtcs + 1) * sizeof(RRCrtcPtr));
#endif /* !defined(NXAGENT_SERVER) */
else else
crtcs = malloc(sizeof(RRCrtcPtr)); crtcs = malloc(sizeof(RRCrtcPtr));
if (!crtcs) if (!crtcs)
...@@ -206,13 +201,8 @@ RRCrtcNotify(RRCrtcPtr crtc, ...@@ -206,13 +201,8 @@ RRCrtcNotify(RRCrtcPtr crtc,
if (numOutputs) { if (numOutputs) {
if (crtc->numOutputs) if (crtc->numOutputs)
#ifndef NXAGENT_SERVER
newoutputs = reallocarray(crtc->outputs, newoutputs = reallocarray(crtc->outputs,
numOutputs, sizeof(RROutputPtr)); numOutputs, sizeof(RROutputPtr));
#else /* !defined(NXAGENT_SERVER) */
newoutputs = realloc(crtc->outputs,
numOutputs * sizeof(RROutputPtr));
#endif /* !defined(NXAGENT_SERVER) */
else else
#ifndef NXAGENT_SERVER #ifndef NXAGENT_SERVER
newoutputs = xallocarray(numOutputs, sizeof(RROutputPtr)); newoutputs = xallocarray(numOutputs, sizeof(RROutputPtr));
......
...@@ -55,13 +55,8 @@ RROldModeAdd(RROutputPtr output, RRScreenSizePtr size, int refresh) ...@@ -55,13 +55,8 @@ RROldModeAdd(RROutputPtr output, RRScreenSizePtr size, int refresh)
} }
if (output->numModes) if (output->numModes)
#ifndef NXAGENT_SERVER
modes = reallocarray(output->modes, modes = reallocarray(output->modes,
output->numModes + 1, sizeof(RRModePtr)); output->numModes + 1, sizeof(RRModePtr));
#else /* !defined(NXAGENT_SERVER) */
modes = realloc(output->modes,
(output->numModes + 1) * sizeof(RRModePtr));
#endif /* !defined(NXAGENT_SERVER) */
else else
modes = malloc(sizeof(RRModePtr)); modes = malloc(sizeof(RRModePtr));
if (!modes) { if (!modes) {
...@@ -271,13 +266,8 @@ RRRegisterSize(ScreenPtr pScreen, ...@@ -271,13 +266,8 @@ RRRegisterSize(ScreenPtr pScreen,
for (i = 0; i < pScrPriv->nSizes; i++) for (i = 0; i < pScrPriv->nSizes; i++)
if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i])) if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i]))
return &pScrPriv->pSizes[i]; return &pScrPriv->pSizes[i];
#ifndef NXAGENT_SERVER
pNew = reallocarray(pScrPriv->pSizes, pNew = reallocarray(pScrPriv->pSizes,
pScrPriv->nSizes + 1, sizeof(RRScreenSize)); pScrPriv->nSizes + 1, sizeof(RRScreenSize));
#else /* !defined(NXAGENT_SERVER) */
pNew = realloc(pScrPriv->pSizes,
(pScrPriv->nSizes + 1) * sizeof(RRScreenSize));
#endif /* !defined(NXAGENT_SERVER) */
if (!pNew) if (!pNew)
return 0; return 0;
pNew[pScrPriv->nSizes++] = tmp; pNew[pScrPriv->nSizes++] = tmp;
...@@ -299,11 +289,7 @@ RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate) ...@@ -299,11 +289,7 @@ RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate)
if (pSize->pRates[i].rate == rate) if (pSize->pRates[i].rate == rate)
return TRUE; return TRUE;
#ifndef NXAGENT_SERVER
pNew = reallocarray(pSize->pRates, pSize->nRates + 1, sizeof(RRScreenRate)); 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) if (!pNew)
return FALSE; return FALSE;
pRate = &pNew[pSize->nRates++]; pRate = &pNew[pSize->nRates++];
......
...@@ -104,11 +104,7 @@ RRModeCreate(xRRModeInfo * modeInfo, const char *name, ScreenPtr userScreen) ...@@ -104,11 +104,7 @@ RRModeCreate(xRRModeInfo * modeInfo, const char *name, ScreenPtr userScreen)
mode->userScreen = userScreen; mode->userScreen = userScreen;
if (num_modes) if (num_modes)
#ifndef NXAGENT_SERVER
newModes = reallocarray(modes, num_modes + 1, sizeof(RRModePtr)); 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 else
newModes = malloc(sizeof(RRModePtr)); newModes = malloc(sizeof(RRModePtr));
......
...@@ -507,14 +507,9 @@ RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor) ...@@ -507,14 +507,9 @@ RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor)
* needs to not have any side-effects on failure * needs to not have any side-effects on failure
*/ */
if (pScrPriv->numMonitors) if (pScrPriv->numMonitors)
#ifndef NXAGENT_SERVER
monitors = reallocarray(pScrPriv->monitors, monitors = reallocarray(pScrPriv->monitors,
pScrPriv->numMonitors + 1, pScrPriv->numMonitors + 1,
sizeof(RRMonitorPtr)); sizeof(RRMonitorPtr));
#else /* !defined(NXAGENT_SERVER) */
monitors = realloc(pScrPriv->monitors,
(pScrPriv->numMonitors + 1) * sizeof(RRMonitorPtr));
#endif /* !defined(NXAGENT_SERVER) */
else else
monitors = malloc(sizeof(RRMonitorPtr)); monitors = malloc(sizeof(RRMonitorPtr));
......
...@@ -75,13 +75,8 @@ RROutputCreate(ScreenPtr pScreen, ...@@ -75,13 +75,8 @@ RROutputCreate(ScreenPtr pScreen,
pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
if (pScrPriv->numOutputs) if (pScrPriv->numOutputs)
#ifndef NXAGENT_SERVER
outputs = reallocarray(pScrPriv->outputs, outputs = reallocarray(pScrPriv->outputs,
pScrPriv->numOutputs + 1, sizeof(RROutputPtr)); pScrPriv->numOutputs + 1, sizeof(RROutputPtr));
#else /* !defined(NXAGENT_SERVER) */
outputs = realloc(pScrPriv->outputs,
(pScrPriv->numOutputs + 1) * sizeof(RROutputPtr));
#endif /* !defined(NXAGENT_SERVER) */
else else
outputs = malloc(sizeof(RROutputPtr)); outputs = malloc(sizeof(RROutputPtr));
if (!outputs) if (!outputs)
...@@ -228,13 +223,8 @@ RROutputAddUserMode(RROutputPtr output, RRModePtr mode) ...@@ -228,13 +223,8 @@ RROutputAddUserMode(RROutputPtr output, RRModePtr mode)
return BadMatch; return BadMatch;
if (output->userModes) if (output->userModes)
#ifndef NXAGENT_SERVER
newModes = reallocarray(output->userModes, newModes = reallocarray(output->userModes,
output->numUserModes + 1, sizeof(RRModePtr)); output->numUserModes + 1, sizeof(RRModePtr));
#else /* !defined(NXAGENT_SERVER) */
newModes = realloc(output->userModes,
(output->numUserModes + 1) * sizeof(RRModePtr));
#endif /* !defined(NXAGENT_SERVER) */
else else
newModes = malloc(sizeof(RRModePtr)); newModes = malloc(sizeof(RRModePtr));
if (!newModes) 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