diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-06 01:44:06 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-13 00:22:37 +0700 |
commit | 3f3ff971ecff9936cebafc813af9193b97bba89c (patch) | |
tree | fdbbad794a42488b7ffe41eed7aba4e498335f55 /dix/atom.c | |
parent | 96c7ab27c383ec767f62a7a11e5fd76f86363fbc (diff) |
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>
Diffstat (limited to 'dix/atom.c')
-rw-r--r-- | dix/atom.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/dix/atom.c b/dix/atom.c index f5bf8ad7e..ecfe4b0c7 100644 --- a/dix/atom.c +++ b/dix/atom.c @@ -109,7 +109,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit) { NodePtr nd; - nd = xalloc(sizeof(NodeRec)); + nd = malloc(sizeof(NodeRec)); if (!nd) return BAD_RESOURCE; if (lastAtom < XA_LAST_PREDEFINED) @@ -118,9 +118,9 @@ MakeAtom(const char *string, unsigned len, Bool makeit) } else { - char *newstring = xalloc(len + 1); + char *newstring = malloc(len + 1); if (!newstring) { - xfree(nd); + free(nd); return BAD_RESOURCE; } strncpy(newstring, string, (int)len); @@ -130,12 +130,12 @@ MakeAtom(const char *string, unsigned len, Bool makeit) if ((lastAtom + 1) >= tableLength) { NodePtr *table; - table = (NodePtr *) xrealloc(nodeTable, + table = (NodePtr *) realloc(nodeTable, tableLength * (2 * sizeof(NodePtr))); if (!table) { if (nd->string != string) - xfree(nd->string); - xfree(nd); + free(nd->string); + free(nd); return BAD_RESOURCE; } tableLength <<= 1; @@ -181,8 +181,8 @@ FreeAtom(NodePtr patom) if(patom->right) FreeAtom(patom->right); if (patom->a > XA_LAST_PREDEFINED) - xfree(patom->string); - xfree(patom); + free(patom->string); + free(patom); } void @@ -192,7 +192,7 @@ FreeAllAtoms(void) return; FreeAtom(atomRoot); atomRoot = (NodePtr)NULL; - xfree(nodeTable); + free(nodeTable); nodeTable = (NodePtr *)NULL; lastAtom = None; } @@ -202,7 +202,7 @@ InitAtoms(void) { FreeAllAtoms(); tableLength = InitialTableSize; - nodeTable = xalloc(InitialTableSize*sizeof(NodePtr)); + nodeTable = malloc(InitialTableSize*sizeof(NodePtr)); if (!nodeTable) AtomError(); nodeTable[None] = (NodePtr)NULL; |