Commit 7011de15 authored by Mihai Moldovan's avatar Mihai Moldovan

misc nx-X11/programs/Xserver/randr/: switch to using xreallocarray, since it has been ported now.

parent 5413c5ec
...@@ -204,11 +204,7 @@ RRCrtcNotify(RRCrtcPtr crtc, ...@@ -204,11 +204,7 @@ RRCrtcNotify(RRCrtcPtr crtc,
newoutputs = reallocarray(crtc->outputs, newoutputs = reallocarray(crtc->outputs,
numOutputs, sizeof(RROutputPtr)); numOutputs, sizeof(RROutputPtr));
else else
#ifndef NXAGENT_SERVER
newoutputs = xallocarray(numOutputs, sizeof(RROutputPtr)); newoutputs = xallocarray(numOutputs, sizeof(RROutputPtr));
#else /* !defined(NXAGENT_SERVER) */
newoutputs = malloc(numOutputs * sizeof(RROutputPtr));
#endif /* !defined(NXAGENT_SERVER) */
if (!newoutputs) if (!newoutputs)
return FALSE; return FALSE;
} }
...@@ -884,11 +880,7 @@ RRCrtcGammaSetSize(RRCrtcPtr crtc, int size) ...@@ -884,11 +880,7 @@ RRCrtcGammaSetSize(RRCrtcPtr crtc, int size)
if (size == crtc->gammaSize) if (size == crtc->gammaSize)
return TRUE; return TRUE;
if (size) { if (size) {
#ifndef NXAGENT_SERVER
gamma = xallocarray(size, 3 * sizeof(CARD16)); gamma = xallocarray(size, 3 * sizeof(CARD16));
#else /* !defined(NXAGENT_SERVER) */
gamma = malloc(size * 3 * sizeof(CARD16));
#endif /* !defined(NXAGENT_SERVER) */
if (!gamma) if (!gamma)
return FALSE; return FALSE;
} }
...@@ -1131,11 +1123,7 @@ ProcRRSetCrtcConfig(ClientPtr client) ...@@ -1131,11 +1123,7 @@ ProcRRSetCrtcConfig(ClientPtr client)
return BadMatch; return BadMatch;
} }
if (numOutputs) { if (numOutputs) {
#ifndef NXAGENT_SERVER
outputs = xallocarray(numOutputs, sizeof(RROutputPtr)); outputs = xallocarray(numOutputs, sizeof(RROutputPtr));
#else /* !defined(NXAGENT_SERVER) */
outputs = malloc(numOutputs * sizeof(RROutputPtr));
#endif /* !defined(NXAGENT_SERVER) */
if (!outputs) if (!outputs)
return BadAlloc; return BadAlloc;
} }
......
...@@ -212,11 +212,7 @@ RRModesForScreen(ScreenPtr pScreen, int *num_ret) ...@@ -212,11 +212,7 @@ RRModesForScreen(ScreenPtr pScreen, int *num_ret)
RRModePtr *screen_modes; RRModePtr *screen_modes;
int num_screen_modes = 0; int num_screen_modes = 0;
#ifndef NXAGENT_SERVER
screen_modes = xallocarray((num_modes ? num_modes : 1), sizeof(RRModePtr)); screen_modes = xallocarray((num_modes ? num_modes : 1), sizeof(RRModePtr));
#else /* !defined(NXAGENT_SERVER) */
screen_modes = malloc((num_modes ? num_modes : 1) * sizeof(RRModePtr));
#endif /* !defined(NXAGENT_SERVER) */
if (!screen_modes) if (!screen_modes)
return NULL; return NULL;
......
...@@ -139,11 +139,7 @@ RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones) ...@@ -139,11 +139,7 @@ RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones)
return TRUE; return TRUE;
} }
if (numClones) { if (numClones) {
#ifndef NXAGENT_SERVER
newClones = xallocarray(numClones, sizeof(RROutputPtr)); newClones = xallocarray(numClones, sizeof(RROutputPtr));
#else /* !defined(NXAGENT_SERVER) */
newClones = malloc(numClones * sizeof(RROutputPtr));
#endif /* !defined(NXAGENT_SERVER) */
if (!newClones) if (!newClones)
return FALSE; return FALSE;
} }
...@@ -176,11 +172,7 @@ RROutputSetModes(RROutputPtr output, ...@@ -176,11 +172,7 @@ RROutputSetModes(RROutputPtr output,
} }
if (numModes) { if (numModes) {
#ifndef NXAGENT_SERVER
newModes = xallocarray(numModes, sizeof(RRModePtr)); newModes = xallocarray(numModes, sizeof(RRModePtr));
#else /* !defined(NXAGENT_SERVER) */
newModes = malloc(numModes * sizeof(RRModePtr));
#endif /* !defined(NXAGENT_SERVER) */
if (!newModes) if (!newModes)
return FALSE; return FALSE;
} }
...@@ -279,11 +271,7 @@ RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs) ...@@ -279,11 +271,7 @@ RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs)
return TRUE; return TRUE;
} }
if (numCrtcs) { if (numCrtcs) {
#ifndef NXAGENT_SERVER
newCrtcs = xallocarray(numCrtcs, sizeof(RRCrtcPtr)); newCrtcs = xallocarray(numCrtcs, sizeof(RRCrtcPtr));
#else /* !defined(NXAGENT_SERVER) */
newCrtcs = malloc(numCrtcs * sizeof(RRCrtcPtr));
#endif /* !defined(NXAGENT_SERVER) */
if (!newCrtcs) if (!newCrtcs)
return FALSE; return FALSE;
} }
......
...@@ -183,11 +183,7 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, ...@@ -183,11 +183,7 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
if (mode == PropModeReplace || len > 0) { if (mode == PropModeReplace || len > 0) {
void *new_data = NULL, *old_data = NULL; void *new_data = NULL, *old_data = NULL;
#ifndef NXAGENT_SERVER
new_value.data = xallocarray(total_len, size_in_bytes); new_value.data = xallocarray(total_len, size_in_bytes);
#else /* !defined(NXAGENT_SERVER) */
new_value.data = malloc(total_len * size_in_bytes);
#endif /* !defined(NXAGENT_SERVER) */
if (!new_value.data && total_len && size_in_bytes) { if (!new_value.data && total_len && size_in_bytes) {
if (add) if (add)
RRDestroyOutputProperty(prop); RRDestroyOutputProperty(prop);
...@@ -356,11 +352,7 @@ RRConfigureOutputProperty(RROutputPtr output, Atom property, ...@@ -356,11 +352,7 @@ RRConfigureOutputProperty(RROutputPtr output, Atom property,
return BadMatch; return BadMatch;
} }
#ifndef NXAGENT_SERVER
new_values = xallocarray(num_values, sizeof(INT32)); new_values = xallocarray(num_values, sizeof(INT32));
#else /* !defined(NXAGENT_SERVER) */
new_values = malloc(num_values * sizeof(INT32));
#endif /* !defined(NXAGENT_SERVER) */
if (!new_values && num_values) { if (!new_values && num_values) {
if (add) if (add)
RRDestroyOutputProperty(prop); RRDestroyOutputProperty(prop);
...@@ -410,11 +402,7 @@ ProcRRListOutputProperties(ClientPtr client) ...@@ -410,11 +402,7 @@ ProcRRListOutputProperties(ClientPtr client)
for (prop = output->properties; prop; prop = prop->next) for (prop = output->properties; prop; prop = prop->next)
numProps++; numProps++;
if (numProps) if (numProps)
#ifndef NXAGENT_SERVER
if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
#else /* !defined(NXAGENT_SERVER) */
if (!(pAtoms = malloc(numProps * sizeof(Atom))))
#endif /* !defined(NXAGENT_SERVER) */
return BadAlloc; return BadAlloc;
rep = (xRRListOutputPropertiesReply) { rep = (xRRListOutputPropertiesReply) {
...@@ -461,11 +449,7 @@ ProcRRQueryOutputProperty(ClientPtr client) ...@@ -461,11 +449,7 @@ ProcRRQueryOutputProperty(ClientPtr client)
return BadName; return BadName;
if (prop->num_valid) { if (prop->num_valid) {
#ifndef NXAGENT_SERVER
extra = xallocarray(prop->num_valid, sizeof(INT32)); extra = xallocarray(prop->num_valid, sizeof(INT32));
#else /* !defined(NXAGENT_SERVER) */
extra = malloc(prop->num_valid * sizeof(INT32));
#endif /* !defined(NXAGENT_SERVER) */
if (!extra) if (!extra)
return BadAlloc; return BadAlloc;
} }
......
...@@ -354,11 +354,7 @@ RRConfigureProviderProperty(RRProviderPtr provider, Atom property, ...@@ -354,11 +354,7 @@ RRConfigureProviderProperty(RRProviderPtr provider, Atom property,
return BadMatch; return BadMatch;
} }
#ifndef NXAGENT_SERVER
new_values = xallocarray(num_values, sizeof(INT32)); new_values = xallocarray(num_values, sizeof(INT32));
#else /* !defined(NXAGENT_SERVER) */
new_values = malloc(num_values * sizeof(INT32));
#endif /* !defined(NXAGENT_SERVER) */
if (!new_values && num_values) { if (!new_values && num_values) {
if (add) if (add)
...@@ -409,11 +405,7 @@ ProcRRListProviderProperties(ClientPtr client) ...@@ -409,11 +405,7 @@ ProcRRListProviderProperties(ClientPtr client)
for (prop = provider->properties; prop; prop = prop->next) for (prop = provider->properties; prop; prop = prop->next)
numProps++; numProps++;
if (numProps) if (numProps)
#ifndef NXAGENT_SERVER
if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
#else /* !defined(NXAGENT_SERVER) */
if (!(pAtoms = malloc(numProps * sizeof(Atom))))
#endif /* !defined(NXAGENT_SERVER) */
return BadAlloc; return BadAlloc;
rep = (xRRListProviderPropertiesReply) { rep = (xRRListProviderPropertiesReply) {
...@@ -459,11 +451,7 @@ ProcRRQueryProviderProperty(ClientPtr client) ...@@ -459,11 +451,7 @@ ProcRRQueryProviderProperty(ClientPtr client)
return BadName; return BadName;
if (prop->num_valid) { if (prop->num_valid) {
#ifndef NXAGENT_SERVER
extra = xallocarray(prop->num_valid, sizeof(INT32)); extra = xallocarray(prop->num_valid, sizeof(INT32));
#else /* !defined(NXAGENT_SERVER) */
extra = malloc(prop->num_valid * sizeof(INT32));
#endif /* !defined(NXAGENT_SERVER) */
if (!extra) if (!extra)
return BadAlloc; return BadAlloc;
} }
......
...@@ -70,11 +70,7 @@ RRTransformSetFilter(RRTransformPtr dst, ...@@ -70,11 +70,7 @@ RRTransformSetFilter(RRTransformPtr dst,
xFixed *new_params; xFixed *new_params;
if (nparams) { if (nparams) {
#ifndef NXAGENT_SERVER
new_params = xallocarray(nparams, sizeof(xFixed)); new_params = xallocarray(nparams, sizeof(xFixed));
#else /* !defined(NXAGENT_SERVER) */
new_params = malloc(nparams * sizeof(xFixed));
#endif /* !defined(NXAGENT_SERVER) */
if (!new_params) if (!new_params)
return FALSE; return FALSE;
memcpy(new_params, params, nparams * sizeof(xFixed)); memcpy(new_params, params, nparams * sizeof(xFixed));
......
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