diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-13 03:45:21 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-13 06:16:43 +0700 |
commit | 816b79dd061e9839cec94a4986a7820b70ca8a7f (patch) | |
tree | ab38e729955fef636f2a9f2aa649fda625dade11 /dix | |
parent | 63a647abd51f44226cbd16aa04ebc57d07463c6d (diff) |
Remove useless casts
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/atom.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/dix/atom.c b/dix/atom.c index 02843d233..7d04c6833 100644 --- a/dix/atom.c +++ b/dix/atom.c @@ -68,7 +68,7 @@ typedef struct _Node { } NodeRec, *NodePtr; static Atom lastAtom = None; -static NodePtr atomRoot = (NodePtr)NULL; +static NodePtr atomRoot = NULL; static unsigned long tableLength; static NodePtr *nodeTable; @@ -88,7 +88,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit) fp = fp * 27 + string[i]; fp = fp * 27 + string[len - 1 - i]; } - while (*np != (NodePtr) NULL) + while (*np != NULL) { if (fp < (*np)->fingerPrint) np = &((*np)->left); @@ -130,11 +130,12 @@ MakeAtom(const char *string, unsigned len, Bool makeit) if ((lastAtom + 1) >= tableLength) { NodePtr *table; - table = (NodePtr *) realloc(nodeTable, - tableLength * (2 * sizeof(NodePtr))); + table = realloc(nodeTable, tableLength * (2 * sizeof(NodePtr))); if (!table) { - if (nd->string != string) - free(nd->string); + if (nd->string != string) { + /* nd->string has been strdup'ed */ + free((char *)nd->string); + } free(nd); return BAD_RESOURCE; } @@ -142,7 +143,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit) nodeTable = table; } *np = nd; - nd->left = nd->right = (NodePtr) NULL; + nd->left = nd->right = NULL; nd->fingerPrint = fp; nd->a = (++lastAtom); *(nodeTable+lastAtom) = nd; @@ -163,7 +164,7 @@ NameForAtom(Atom atom) { NodePtr node; if (atom > lastAtom) return 0; - if ((node = nodeTable[atom]) == (NodePtr)NULL) return 0; + if ((node = nodeTable[atom]) == NULL) return 0; return node->string; } @@ -193,12 +194,12 @@ FreeAtom(NodePtr patom) void FreeAllAtoms(void) { - if(atomRoot == (NodePtr)NULL) + if(atomRoot == NULL) return; FreeAtom(atomRoot); - atomRoot = (NodePtr)NULL; + atomRoot = NULL; free(nodeTable); - nodeTable = (NodePtr *)NULL; + nodeTable = NULL; lastAtom = None; } @@ -210,7 +211,7 @@ InitAtoms(void) nodeTable = malloc(InitialTableSize*sizeof(NodePtr)); if (!nodeTable) AtomError(); - nodeTable[None] = (NodePtr)NULL; + nodeTable[None] = NULL; MakePredeclaredAtoms(); if (lastAtom != XA_LAST_PREDEFINED) AtomError(); |