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:
@@ -76,10 +76,10 @@ RRDeleteAllOutputProperties (RROutputPtr output)
|
||||
event.timestamp = currentTime.milliseconds;
|
||||
RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
|
||||
if (prop->current.data)
|
||||
xfree(prop->current.data);
|
||||
free(prop->current.data);
|
||||
if (prop->pending.data)
|
||||
xfree(prop->pending.data);
|
||||
xfree(prop);
|
||||
free(prop->pending.data);
|
||||
free(prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ RRCreateOutputProperty (Atom property)
|
||||
{
|
||||
RRPropertyPtr prop;
|
||||
|
||||
prop = (RRPropertyPtr)xalloc(sizeof(RRPropertyRec));
|
||||
prop = (RRPropertyPtr)malloc(sizeof(RRPropertyRec));
|
||||
if (!prop)
|
||||
return NULL;
|
||||
prop->next = NULL;
|
||||
@@ -116,14 +116,14 @@ static void
|
||||
RRDestroyOutputProperty (RRPropertyPtr prop)
|
||||
{
|
||||
if (prop->valid_values)
|
||||
xfree (prop->valid_values);
|
||||
free(prop->valid_values);
|
||||
if (prop->current.data)
|
||||
xfree(prop->current.data);
|
||||
free(prop->current.data);
|
||||
if (prop->pending.data)
|
||||
xfree(prop->pending.data);
|
||||
free(prop->pending.data);
|
||||
if (prop->valid_values)
|
||||
xfree(prop->valid_values);
|
||||
xfree(prop);
|
||||
free(prop->valid_values);
|
||||
free(prop);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -201,7 +201,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
|
||||
pointer new_data = NULL, old_data = NULL;
|
||||
|
||||
total_size = total_len * size_in_bytes;
|
||||
new_value.data = (pointer)xalloc (total_size);
|
||||
new_value.data = (pointer)malloc(total_size);
|
||||
if (!new_value.data && total_size)
|
||||
{
|
||||
if (add)
|
||||
@@ -239,11 +239,11 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
|
||||
prop->propertyName, &new_value))
|
||||
{
|
||||
if (new_value.data)
|
||||
xfree (new_value.data);
|
||||
free(new_value.data);
|
||||
return (BadValue);
|
||||
}
|
||||
if (prop_value->data)
|
||||
xfree (prop_value->data);
|
||||
free(prop_value->data);
|
||||
*prop_value = new_value;
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
|
||||
if (range && (num_values & 1))
|
||||
return BadMatch;
|
||||
|
||||
new_values = xalloc (num_values * sizeof (INT32));
|
||||
new_values = malloc(num_values * sizeof (INT32));
|
||||
if (!new_values && num_values)
|
||||
return BadAlloc;
|
||||
if (num_values)
|
||||
@@ -385,7 +385,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
|
||||
if (prop->is_pending && !pending)
|
||||
{
|
||||
if (prop->pending.data)
|
||||
xfree (prop->pending.data);
|
||||
free(prop->pending.data);
|
||||
RRInitOutputPropertyValue (&prop->pending);
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
|
||||
prop->immutable = immutable;
|
||||
prop->num_valid = num_values;
|
||||
if (prop->valid_values)
|
||||
xfree (prop->valid_values);
|
||||
free(prop->valid_values);
|
||||
prop->valid_values = new_values;
|
||||
|
||||
if (add) {
|
||||
@@ -422,7 +422,7 @@ ProcRRListOutputProperties (ClientPtr client)
|
||||
for (prop = output->properties; prop; prop = prop->next)
|
||||
numProps++;
|
||||
if (numProps)
|
||||
if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
|
||||
if(!(pAtoms = (Atom *)malloc(numProps * sizeof(Atom))))
|
||||
return(BadAlloc);
|
||||
|
||||
rep.type = X_Reply;
|
||||
@@ -445,7 +445,7 @@ ProcRRListOutputProperties (ClientPtr client)
|
||||
{
|
||||
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
|
||||
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
|
||||
xfree(pAtoms);
|
||||
free(pAtoms);
|
||||
}
|
||||
return(client->noClientException);
|
||||
}
|
||||
@@ -468,7 +468,7 @@ ProcRRQueryOutputProperty (ClientPtr client)
|
||||
return BadName;
|
||||
|
||||
if (prop->num_valid) {
|
||||
extra = xalloc(prop->num_valid * sizeof(INT32));
|
||||
extra = malloc(prop->num_valid * sizeof(INT32));
|
||||
if (!extra)
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -491,7 +491,7 @@ ProcRRQueryOutputProperty (ClientPtr client)
|
||||
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
|
||||
WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32),
|
||||
extra);
|
||||
xfree(extra);
|
||||
free(extra);
|
||||
}
|
||||
return(client->noClientException);
|
||||
}
|
||||
@@ -699,7 +699,7 @@ ProcRRGetOutputProperty (ClientPtr client)
|
||||
len = min(n - ind, 4 * stuff->longLength);
|
||||
|
||||
if (len) {
|
||||
extra = xalloc(len);
|
||||
extra = malloc(len);
|
||||
if (!extra)
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -745,7 +745,7 @@ ProcRRGetOutputProperty (ClientPtr client)
|
||||
}
|
||||
WriteSwappedDataToClient(client, len,
|
||||
extra);
|
||||
xfree(extra);
|
||||
free(extra);
|
||||
}
|
||||
|
||||
if (stuff->delete && (reply.bytesAfter == 0))
|
||||
|
||||
Reference in New Issue
Block a user