Remove useless casts
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
63a647abd5
commit
816b79dd06
25
dix/atom.c
25
dix/atom.c
|
@ -68,7 +68,7 @@ typedef struct _Node {
|
||||||
} NodeRec, *NodePtr;
|
} NodeRec, *NodePtr;
|
||||||
|
|
||||||
static Atom lastAtom = None;
|
static Atom lastAtom = None;
|
||||||
static NodePtr atomRoot = (NodePtr)NULL;
|
static NodePtr atomRoot = NULL;
|
||||||
static unsigned long tableLength;
|
static unsigned long tableLength;
|
||||||
static NodePtr *nodeTable;
|
static NodePtr *nodeTable;
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
|
||||||
fp = fp * 27 + string[i];
|
fp = fp * 27 + string[i];
|
||||||
fp = fp * 27 + string[len - 1 - i];
|
fp = fp * 27 + string[len - 1 - i];
|
||||||
}
|
}
|
||||||
while (*np != (NodePtr) NULL)
|
while (*np != NULL)
|
||||||
{
|
{
|
||||||
if (fp < (*np)->fingerPrint)
|
if (fp < (*np)->fingerPrint)
|
||||||
np = &((*np)->left);
|
np = &((*np)->left);
|
||||||
|
@ -130,11 +130,12 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
|
||||||
if ((lastAtom + 1) >= tableLength) {
|
if ((lastAtom + 1) >= tableLength) {
|
||||||
NodePtr *table;
|
NodePtr *table;
|
||||||
|
|
||||||
table = (NodePtr *) realloc(nodeTable,
|
table = realloc(nodeTable, tableLength * (2 * sizeof(NodePtr)));
|
||||||
tableLength * (2 * sizeof(NodePtr)));
|
|
||||||
if (!table) {
|
if (!table) {
|
||||||
if (nd->string != string)
|
if (nd->string != string) {
|
||||||
free(nd->string);
|
/* nd->string has been strdup'ed */
|
||||||
|
free((char *)nd->string);
|
||||||
|
}
|
||||||
free(nd);
|
free(nd);
|
||||||
return BAD_RESOURCE;
|
return BAD_RESOURCE;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +143,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
|
||||||
nodeTable = table;
|
nodeTable = table;
|
||||||
}
|
}
|
||||||
*np = nd;
|
*np = nd;
|
||||||
nd->left = nd->right = (NodePtr) NULL;
|
nd->left = nd->right = NULL;
|
||||||
nd->fingerPrint = fp;
|
nd->fingerPrint = fp;
|
||||||
nd->a = (++lastAtom);
|
nd->a = (++lastAtom);
|
||||||
*(nodeTable+lastAtom) = nd;
|
*(nodeTable+lastAtom) = nd;
|
||||||
|
@ -163,7 +164,7 @@ NameForAtom(Atom atom)
|
||||||
{
|
{
|
||||||
NodePtr node;
|
NodePtr node;
|
||||||
if (atom > lastAtom) return 0;
|
if (atom > lastAtom) return 0;
|
||||||
if ((node = nodeTable[atom]) == (NodePtr)NULL) return 0;
|
if ((node = nodeTable[atom]) == NULL) return 0;
|
||||||
return node->string;
|
return node->string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,12 +194,12 @@ FreeAtom(NodePtr patom)
|
||||||
void
|
void
|
||||||
FreeAllAtoms(void)
|
FreeAllAtoms(void)
|
||||||
{
|
{
|
||||||
if(atomRoot == (NodePtr)NULL)
|
if(atomRoot == NULL)
|
||||||
return;
|
return;
|
||||||
FreeAtom(atomRoot);
|
FreeAtom(atomRoot);
|
||||||
atomRoot = (NodePtr)NULL;
|
atomRoot = NULL;
|
||||||
free(nodeTable);
|
free(nodeTable);
|
||||||
nodeTable = (NodePtr *)NULL;
|
nodeTable = NULL;
|
||||||
lastAtom = None;
|
lastAtom = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +211,7 @@ InitAtoms(void)
|
||||||
nodeTable = malloc(InitialTableSize*sizeof(NodePtr));
|
nodeTable = malloc(InitialTableSize*sizeof(NodePtr));
|
||||||
if (!nodeTable)
|
if (!nodeTable)
|
||||||
AtomError();
|
AtomError();
|
||||||
nodeTable[None] = (NodePtr)NULL;
|
nodeTable[None] = NULL;
|
||||||
MakePredeclaredAtoms();
|
MakePredeclaredAtoms();
|
||||||
if (lastAtom != XA_LAST_PREDEFINED)
|
if (lastAtom != XA_LAST_PREDEFINED)
|
||||||
AtomError();
|
AtomError();
|
||||||
|
|
Loading…
Reference in New Issue