3 --- dix/atom.c.orig 2009-03-06 19:05:09.000000000 +0900
5 @@ -74,98 +74,6 @@ static NodePtr *nodeTable;
7 void FreeAtom(NodePtr patom);
10 -MakeAtom(char *string, unsigned len, Bool makeit)
15 - unsigned int fp = 0;
18 - for (i = 0; i < (len+1)/2; i++)
20 - fp = fp * 27 + string[i];
21 - fp = fp * 27 + string[len - 1 - i];
23 - while (*np != (NodePtr) NULL)
25 - if (fp < (*np)->fingerPrint)
26 - np = &((*np)->left);
27 - else if (fp > (*np)->fingerPrint)
28 - np = &((*np)->right);
30 - { /* now start testing the strings */
31 - comp = strncmp(string, (*np)->string, (int)len);
32 - if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string))))
33 - np = &((*np)->left);
35 - np = &((*np)->right);
44 - nd = (NodePtr) xalloc(sizeof(NodeRec));
46 - return BAD_RESOURCE;
47 - if (lastAtom < XA_LAST_PREDEFINED)
49 - nd->string = string;
53 - nd->string = (char *) xalloc(len + 1);
56 - return BAD_RESOURCE;
58 - strncpy(nd->string, string, (int)len);
59 - nd->string[len] = 0;
61 - if ((lastAtom + 1) >= tableLength) {
64 - table = (NodePtr *) xrealloc(nodeTable,
65 - tableLength * (2 * sizeof(NodePtr)));
67 - if (nd->string != string)
70 - return BAD_RESOURCE;
76 - nd->left = nd->right = (NodePtr) NULL;
77 - nd->fingerPrint = fp;
78 - nd->a = (++lastAtom);
79 - *(nodeTable+lastAtom) = nd;
89 - return (atom != None) && (atom <= lastAtom);
93 -NameForAtom(Atom atom)
96 - if (atom > lastAtom) return 0;
97 - if ((node = nodeTable[atom]) == (NodePtr)NULL) return 0;
98 - return node->string;