From 3f3ff971ecff9936cebafc813af9193b97bba89c Mon Sep 17 00:00:00 2001 From: Mikhail Gusarov Date: Thu, 6 May 2010 01:44:06 +0700 Subject: 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 Reviewed-by: Peter Hutterer --- Xext/sync.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'Xext/sync.c') diff --git a/Xext/sync.c b/Xext/sync.c index e865e527a..94ac5dfb1 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -158,7 +158,7 @@ SyncDeleteTriggerFromCounter(SyncTrigger *pTrigger) else pTrigger->pCounter->pTriglist = pCur->next; - xfree(pCur); + free(pCur); break; } @@ -186,7 +186,7 @@ SyncAddTriggerToCounter(SyncTrigger *pTrigger) return Success; } - if (!(pCur = xalloc(sizeof(SyncTriggerList)))) + if (!(pCur = malloc(sizeof(SyncTriggerList)))) return BadAlloc; pCur->pTrigger = pTrigger; @@ -417,7 +417,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait, if (client->clientGone) return; - pev = pEvents = xalloc(num_events * sizeof(xSyncCounterNotifyEvent)); + pev = pEvents = malloc(num_events * sizeof(xSyncCounterNotifyEvent)); if (!pEvents) return; UpdateCurrentTime(); @@ -438,7 +438,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait, } /* swapping will be taken care of by this */ WriteEventsToClient(client, num_events, (xEvent *)pEvents); - xfree(pEvents); + free(pEvents); } @@ -545,7 +545,7 @@ SyncAwaitTriggerFired(SyncTrigger *pTrigger) pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader; numwaits = pAwaitUnion->header.num_waitconditions; - ppAwait = xalloc(numwaits * sizeof(SyncAwait *)); + ppAwait = malloc(numwaits * sizeof(SyncAwait *)); if (!ppAwait) goto bail; @@ -614,7 +614,7 @@ SyncAwaitTriggerFired(SyncTrigger *pTrigger) if (num_events) SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait, num_events); - xfree(ppAwait); + free(ppAwait); bail: /* unblock the client */ @@ -695,7 +695,7 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents) /* add new client to pAlarm->pEventClients */ - pClients = xalloc(sizeof(SyncAlarmClientList)); + pClients = malloc(sizeof(SyncAlarmClientList)); if (!pClients) return BadAlloc; @@ -706,7 +706,7 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents) pClients->delete_id = FakeClientID(client->index); if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm)) { - xfree(pClients); + free(pClients); return BadAlloc; } @@ -824,12 +824,12 @@ SyncCreateCounter(ClientPtr client, XSyncCounter id, CARD64 initialvalue) { SyncCounter *pCounter; - if (!(pCounter = xalloc(sizeof(SyncCounter)))) + if (!(pCounter = malloc(sizeof(SyncCounter)))) return NULL; if (!AddResource(id, RTCounter, (pointer) pCounter)) { - xfree(pCounter); + free(pCounter); return NULL; } @@ -863,7 +863,7 @@ SyncCreateSystemCounter( { SyncCounter *pCounter; - SysCounterList = xrealloc(SysCounterList, + SysCounterList = realloc(SysCounterList, (SyncNumSystemCounters+1)*sizeof(SyncCounter *)); if (!SysCounterList) return NULL; @@ -886,7 +886,7 @@ SyncCreateSystemCounter( { SysCounterInfo *psci; - psci = xalloc(sizeof(SysCounterInfo)); + psci = malloc(sizeof(SysCounterInfo)); if (!psci) { FreeResource(pCounter->id, RT_NONE); @@ -1008,7 +1008,7 @@ FreeAlarm(void *addr, XID id) SyncDeleteTriggerFromCounter(&pAlarm->trigger); - xfree(pAlarm); + free(pAlarm); return Success; } @@ -1029,13 +1029,13 @@ FreeCounter(void *env, XID id) { (*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger); pnext = ptl->next; - xfree(ptl); /* destroy the trigger list as we go */ + free(ptl); /* destroy the trigger list as we go */ } if (IsSystemCounter(pCounter)) { int i, found = 0; - xfree(pCounter->pSysCounterInfo); + free(pCounter->pSysCounterInfo); /* find the counter in the list of system counters and remove it */ @@ -1059,7 +1059,7 @@ FreeCounter(void *env, XID id) } SyncNumSystemCounters--; } - xfree(pCounter); + free(pCounter); return Success; } @@ -1088,7 +1088,7 @@ FreeAwait(void *addr, XID id) if (pCounter && !pCounter->beingDestroyed) SyncDeleteTriggerFromCounter(&pAwait->trigger); } - xfree(pAwaitUnion); + free(pAwaitUnion); return Success; } @@ -1109,7 +1109,7 @@ FreeAlarmClient(void *value, XID id) pPrev->next = pCur->next; else pAlarm->pEventClients = pCur->next; - xfree(pCur); + free(pCur); return Success; } } @@ -1174,7 +1174,7 @@ ProcSyncListSystemCounters(ClientPtr client) if (len) { - walklist = list = xalloc(len); + walklist = list = malloc(len); if (!list) return BadAlloc; } @@ -1220,7 +1220,7 @@ ProcSyncListSystemCounters(ClientPtr client) if (len) { WriteToClient(client, len, (char *) list); - xfree(list); + free(list); } return client->noClientException; @@ -1448,7 +1448,7 @@ ProcSyncAwait(ClientPtr client) /* all the memory for the entire await list is allocated * here in one chunk */ - pAwaitUnion = xalloc((items+1) * sizeof(SyncAwaitUnion)); + pAwaitUnion = malloc((items+1) * sizeof(SyncAwaitUnion)); if (!pAwaitUnion) return BadAlloc; @@ -1457,7 +1457,7 @@ ProcSyncAwait(ClientPtr client) pAwaitUnion->header.delete_id = FakeClientID(client->index); if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion)) { - xfree(pAwaitUnion); + free(pAwaitUnion); return BadAlloc; } @@ -1595,7 +1595,7 @@ ProcSyncCreateAlarm(ClientPtr client) if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta)))) return BadLength; - if (!(pAlarm = xalloc(sizeof(SyncAlarm)))) + if (!(pAlarm = malloc(sizeof(SyncAlarm)))) { return BadAlloc; } @@ -1612,7 +1612,7 @@ ProcSyncCreateAlarm(ClientPtr client) status = SyncInitTrigger(client, pTrigger, None, XSyncCAAllTrigger); if (status != Success) { - xfree(pAlarm); + free(pAlarm); return status; } @@ -1626,13 +1626,13 @@ ProcSyncCreateAlarm(ClientPtr client) (CARD32 *)&stuff[1]); if (status != Success) { - xfree(pAlarm); + free(pAlarm); return status; } if (!AddResource(stuff->id, RTAlarm, pAlarm)) { - xfree(pAlarm); + free(pAlarm); return BadAlloc; } @@ -2091,7 +2091,7 @@ SAlarmNotifyEvent(xSyncAlarmNotifyEvent *from, xSyncAlarmNotifyEvent *to) static void SyncResetProc(ExtensionEntry *extEntry) { - xfree(SysCounterList); + free(SysCounterList); SysCounterList = NULL; RTCounter = 0; } -- cgit v1.2.3