diff options
Diffstat (limited to 'generic/tkAtom.c')
-rw-r--r-- | generic/tkAtom.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/generic/tkAtom.c b/generic/tkAtom.c index 54d3598..2491fb2 100644 --- a/generic/tkAtom.c +++ b/generic/tkAtom.c @@ -20,7 +20,7 @@ * those found in xatom.h */ -static char * atomNameArray[] = { +static const char *const atomNameArray[] = { "PRIMARY", "SECONDARY", "ARC", "ATOM", "BITMAP", "CARDINAL", "COLORMAP", "CURSOR", "CUT_BUFFER0", @@ -76,10 +76,10 @@ Atom Tk_InternAtom( Tk_Window tkwin, /* Window token; map name to atom for this * window's display. */ - CONST char *name) /* Name to turn into atom. */ + const char *name) /* Name to turn into atom. */ { - register TkDisplay *dispPtr; - register Tcl_HashEntry *hPtr; + TkDisplay *dispPtr; + Tcl_HashEntry *hPtr; int isNew; dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -97,7 +97,7 @@ Tk_InternAtom( hPtr2 = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr2, Tcl_GetHashKey(&dispPtr->nameTable, hPtr)); } - return (Atom) PTR2INT(Tcl_GetHashValue(hPtr)); + return (Atom)PTR2INT(Tcl_GetHashValue(hPtr)); } /* @@ -121,14 +121,14 @@ Tk_InternAtom( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_GetAtomName( Tk_Window tkwin, /* Window token; map atom to name relative to * this window's display. */ Atom atom) /* Atom whose name is wanted. */ { - register TkDisplay *dispPtr; - register Tcl_HashEntry *hPtr; + TkDisplay *dispPtr; + Tcl_HashEntry *hPtr; dispPtr = ((TkWindow *) tkwin)->dispPtr; if (!dispPtr->atomInit) { @@ -137,23 +137,22 @@ Tk_GetAtomName( hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, INT2PTR(atom)); if (hPtr == NULL) { - char *name; + const char *name; Tk_ErrorHandler handler; - int isNew, mustFree; + int isNew; + char *mustFree = NULL; handler = Tk_CreateErrorHandler(dispPtr->display, BadAtom, -1, -1, - NULL, (ClientData) NULL); - name = XGetAtomName(dispPtr->display, atom); - mustFree = 1; + NULL, NULL); + name = mustFree = XGetAtomName(dispPtr->display, atom); if (name == NULL) { name = "?bad atom?"; - mustFree = 0; } Tk_DeleteErrorHandler(handler); hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); Tcl_SetHashValue(hPtr, INT2PTR(atom)); if (mustFree) { - XFree(name); + XFree(mustFree); } name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); @@ -180,7 +179,7 @@ Tk_GetAtomName( static void AtomInit( - register TkDisplay *dispPtr)/* Display to initialize. */ + TkDisplay *dispPtr)/* Display to initialize. */ { Tcl_HashEntry *hPtr; Atom atom; @@ -190,7 +189,7 @@ AtomInit( Tcl_InitHashTable(&dispPtr->atomTable, TCL_ONE_WORD_KEYS); for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) { - char *name; + const char *name; int isNew; hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, INT2PTR(atom)); |