diff options
author | marha <marha@users.sourceforge.net> | 2009-09-09 05:23:48 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-09 05:23:48 +0000 |
commit | 81f91c615982e50bb62708201569c33a3cd3d973 (patch) | |
tree | 4f32ecc48a3b7b5e76642f3792338263c53879bd /xorg-server/dix/atom.c | |
parent | b571a562410f565af2bdde52d9f7f9a23ffae04f (diff) | |
parent | a915739887477b28d924ecc8417ee107d125bd6c (diff) | |
download | vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.gz vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.bz2 vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.zip |
svn merge https://vcxsrv.svn.sourceforge.net/svnroot/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/dix/atom.c')
-rw-r--r-- | xorg-server/dix/atom.c | 23 |
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; |