Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
24
mi/micmap.c
24
mi/micmap.c
@@ -380,7 +380,7 @@ miClearVisualTypes(void)
|
||||
|
||||
while ((v = miVisuals)) {
|
||||
miVisuals = v->next;
|
||||
xfree(v);
|
||||
free(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
|
||||
miVisualsPtr new, *prev, v;
|
||||
int count;
|
||||
|
||||
new = xalloc (sizeof *new);
|
||||
new = malloc(sizeof *new);
|
||||
if (!new)
|
||||
return FALSE;
|
||||
if (!redMask || !greenMask || !blueMask)
|
||||
@@ -534,14 +534,14 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
|
||||
ndepth++;
|
||||
nvisual += visuals->count;
|
||||
}
|
||||
depth = xalloc (ndepth * sizeof (DepthRec));
|
||||
visual = xalloc (nvisual * sizeof (VisualRec));
|
||||
preferredCVCs = xalloc(ndepth * sizeof(int));
|
||||
depth = malloc(ndepth * sizeof (DepthRec));
|
||||
visual = malloc(nvisual * sizeof (VisualRec));
|
||||
preferredCVCs = malloc(ndepth * sizeof(int));
|
||||
if (!depth || !visual || !preferredCVCs)
|
||||
{
|
||||
xfree (depth);
|
||||
xfree (visual);
|
||||
xfree (preferredCVCs);
|
||||
free(depth);
|
||||
free(visual);
|
||||
free(preferredCVCs);
|
||||
return FALSE;
|
||||
}
|
||||
*depthp = depth;
|
||||
@@ -560,9 +560,9 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
|
||||
vid = NULL;
|
||||
if (nvtype)
|
||||
{
|
||||
vid = xalloc (nvtype * sizeof (VisualID));
|
||||
vid = malloc(nvtype * sizeof (VisualID));
|
||||
if (!vid) {
|
||||
xfree(preferredCVCs);
|
||||
free(preferredCVCs);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -604,7 +604,7 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
|
||||
vid++;
|
||||
visual++;
|
||||
}
|
||||
xfree (visuals);
|
||||
free(visuals);
|
||||
}
|
||||
miVisuals = NULL;
|
||||
visual = *visualp;
|
||||
@@ -660,7 +660,7 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
|
||||
}
|
||||
*rootDepthp = depth[i].depth;
|
||||
*defaultVisp = depth[i].vids[j];
|
||||
xfree(preferredCVCs);
|
||||
free(preferredCVCs);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user