aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/atom.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
committermarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
commita915739887477b28d924ecc8417ee107d125bd6c (patch)
treec02f315476b61892d1fd89182e18943dce8d6277 /xorg-server/dix/atom.c
parent6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 (diff)
downloadvcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.gz
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.bz2
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.zip
Switched to xorg-server-1.6.99.900.tar.gz
Diffstat (limited to 'xorg-server/dix/atom.c')
-rw-r--r--xorg-server/dix/atom.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/xorg-server/dix/atom.c b/xorg-server/dix/atom.c
index c968c1e5a..f5bf8ad7e 100644
--- a/xorg-server/dix/atom.c
+++ b/xorg-server/dix/atom.c
@@ -64,7 +64,7 @@ typedef struct _Node {
struct _Node *left, *right;
Atom a;
unsigned int fingerPrint;
- char *string;
+ const char *string;
} NodeRec, *NodePtr;
static Atom lastAtom = None;
@@ -74,8 +74,8 @@ static NodePtr *nodeTable;
void FreeAtom(NodePtr patom);
-_X_EXPORT Atom
-MakeAtom(char *string, unsigned len, Bool makeit)
+Atom
+MakeAtom(const char *string, unsigned len, Bool makeit)
{
NodePtr * np;
unsigned i;
@@ -109,7 +109,7 @@ MakeAtom(char *string, unsigned len, Bool makeit)
{
NodePtr nd;
- nd = (NodePtr) xalloc(sizeof(NodeRec));
+ nd = xalloc(sizeof(NodeRec));
if (!nd)
return BAD_RESOURCE;
if (lastAtom < XA_LAST_PREDEFINED)
@@ -118,13 +118,14 @@ MakeAtom(char *string, unsigned len, Bool makeit)
}
else
{
- nd->string = (char *) xalloc(len + 1);
- if (!nd->string) {
+ char *newstring = xalloc(len + 1);
+ if (!newstring) {
xfree(nd);
return BAD_RESOURCE;
}
- strncpy(nd->string, string, (int)len);
- nd->string[len] = 0;
+ strncpy(newstring, string, (int)len);
+ newstring[len] = 0;
+ nd->string = newstring;
}
if ((lastAtom + 1) >= tableLength) {
NodePtr *table;
@@ -151,13 +152,13 @@ MakeAtom(char *string, unsigned len, Bool makeit)
return None;
}
-_X_EXPORT Bool
+Bool
ValidAtom(Atom atom)
{
return (atom != None) && (atom <= lastAtom);
}
-_X_EXPORT char *
+const char *
NameForAtom(Atom atom)
{
NodePtr node;
@@ -201,7 +202,7 @@ InitAtoms(void)
{
FreeAllAtoms();
tableLength = InitialTableSize;
- nodeTable = (NodePtr *)xalloc(InitialTableSize*sizeof(NodePtr));
+ nodeTable = xalloc(InitialTableSize*sizeof(NodePtr));
if (!nodeTable)
AtomError();
nodeTable[None] = (NodePtr)NULL;