From 7b6e25bd97a76f688ed363cac924ea99a83fa5f4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 2 Jul 2019 09:24:24 +0000 Subject: Statically initialize "X11ControlChars" pseudo-encoding. --- unix/tkUnixFont.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index dc80807..50033ec 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -316,14 +316,8 @@ TkpFontPkgInit( Tcl_Encoding ucs2; if (tsdPtr->controlFamily.encoding == NULL) { - Tcl_EncodingType type; - type.encodingName = "X11ControlChars"; - type.toUtfProc = ControlUtfProc; - type.fromUtfProc = ControlUtfProc; - type.freeProc = NULL; - type.clientData = NULL; - type.nullSize = 0; + Tcl_EncodingType type = {"X11ControlChars", ControlUtfProc, ControlUtfProc, NULL, NULL, 0}; tsdPtr->controlFamily.refCount = 2; tsdPtr->controlFamily.encoding = Tcl_CreateEncoding(&type); tsdPtr->controlFamily.isTwoByteFont = 0; @@ -342,8 +336,8 @@ TkpFontPkgInit( ucs2 = Tcl_GetEncoding(NULL, "ucs-2be"); if (ucs2 == NULL) { - Tcl_EncodingType type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2}; - Tcl_CreateEncoding(&type); + Tcl_EncodingType ucs2type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2}; + Tcl_CreateEncoding(&ucs2type); } else { Tcl_FreeEncoding(ucs2); } -- cgit v0.12 From 8d9bcf37ddbe36e3fd50042d8dfb15bc5a6c2d12 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 2 Jul 2019 09:28:05 +0000 Subject: Don't use "struct ThreadSpecificData", while the type name "ThreadSpecificData" is already sufficient. --- generic/tkBitmap.c | 2 +- generic/tkButton.c | 2 +- generic/tkColor.c | 2 +- generic/tkConfig.c | 2 +- generic/tkEvent.c | 2 +- generic/tkGet.c | 2 +- generic/tkImage.c | 2 +- generic/tkImgPhoto.c | 2 +- generic/tkMacWinMenu.c | 2 +- generic/tkMenu.c | 2 +- generic/tkObj.c | 2 +- generic/tkOption.c | 2 +- generic/tkPointer.c | 2 +- generic/tkSelect.c | 2 +- generic/tkStyle.c | 2 +- generic/tkWindow.c | 2 +- unix/tkUnixEmbed.c | 2 +- unix/tkUnixEvent.c | 2 +- unix/tkUnixFont.c | 2 +- unix/tkUnixRFont.c | 4 ++-- unix/tkUnixSelect.c | 2 +- unix/tkUnixSend.c | 2 +- win/tkWinButton.c | 2 +- win/tkWinDialog.c | 2 +- win/tkWinDraw.c | 2 +- win/tkWinEmbed.c | 2 +- win/tkWinFont.c | 2 +- win/tkWinMenu.c | 2 +- win/tkWinWindow.c | 2 +- win/tkWinWm.c | 2 +- win/tkWinX.c | 2 +- 31 files changed, 32 insertions(+), 32 deletions(-) diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index 88f3e2b..54bab69 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -88,7 +88,7 @@ typedef struct { int width, height; /* Dimensions of bitmap. */ } DataKey; -typedef struct ThreadSpecificData { +typedef struct { int initialized; /* 0 means table below needs initializing. */ Tcl_HashTable predefBitmapTable; /* Hash table created by Tk_DefineBitmap to diff --git a/generic/tkButton.c b/generic/tkButton.c index 0d760b0..37cfcd2 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -16,7 +16,7 @@ #include "tkButton.h" #include "default.h" -typedef struct ThreadSpecificData { +typedef struct { int defaultsInitialized; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; diff --git a/generic/tkColor.c b/generic/tkColor.c index ccb9914..f6650f9 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -31,7 +31,7 @@ typedef struct { * The structure below is used to allocate thread-local data. */ -typedef struct ThreadSpecificData { +typedef struct { char rgbString[20]; /* */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; diff --git a/generic/tkConfig.c b/generic/tkConfig.c index d3c8aad..f1a5176 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -31,7 +31,7 @@ * the option tables that have been created for a thread. */ -typedef struct ThreadSpecificData { +typedef struct { int initialized; /* 0 means table below needs initializing. */ Tcl_HashTable hashTable; } ThreadSpecificData; diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 891f667..b36d5de 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -139,7 +139,7 @@ typedef struct ExitHandler { * storage for the current thread. */ -typedef struct ThreadSpecificData { +typedef struct { int handlersActive; /* The following variable has a non-zero value * when a handler is active. */ InProgress *pendingPtr; /* Topmost search in progress, or NULL if diff --git a/generic/tkGet.c b/generic/tkGet.c index d58b4a5..6eff3a3 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.c @@ -22,7 +22,7 @@ * the current thread. */ -typedef struct ThreadSpecificData { +typedef struct { int initialized; Tcl_HashTable uidTable; } ThreadSpecificData; diff --git a/generic/tkImage.c b/generic/tkImage.c index 32e09c0..dc4e8e0 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -66,7 +66,7 @@ typedef struct ImageMaster { * when the world is falling apart.) */ } ImageMaster; -typedef struct ThreadSpecificData { +typedef struct { Tk_ImageType *imageTypeList;/* First in a list of all known image * types. */ Tk_ImageType *oldImageTypeList; diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 26f1f26..03b3731 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -125,7 +125,7 @@ Tk_ImageType tkPhotoImageType = { NULL }; -typedef struct ThreadSpecificData { +typedef struct { Tk_PhotoImageFormat *formatList; /* Pointer to the first in the list of known * photo image formats.*/ diff --git a/generic/tkMacWinMenu.c b/generic/tkMacWinMenu.c index 9449838..ab92fec 100644 --- a/generic/tkMacWinMenu.c +++ b/generic/tkMacWinMenu.c @@ -13,7 +13,7 @@ #include "tkInt.h" #include "tkMenu.h" -typedef struct ThreadSpecificData { +typedef struct { int postCommandGeneration; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 3a2d987..d755096 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -77,7 +77,7 @@ #define MENU_HASH_KEY "tkMenus" -typedef struct ThreadSpecificData { +typedef struct { int menusInitialized; /* Flag indicates whether thread-specific * elements of the Windows Menu module have * been initialized. */ diff --git a/generic/tkObj.c b/generic/tkObj.c index 46f2da5..94d9879 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -47,7 +47,7 @@ typedef struct PixelRep { * thread. */ -typedef struct ThreadSpecificData { +typedef struct { const Tcl_ObjType *doubleTypePtr; const Tcl_ObjType *intTypePtr; } ThreadSpecificData; diff --git a/generic/tkOption.c b/generic/tkOption.c index 545a9b9..713a6d5 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.c @@ -176,7 +176,7 @@ typedef struct StackLevel { * of a level. */ } StackLevel; -typedef struct ThreadSpecificData { +typedef struct { int initialized; /* 0 means the ThreadSpecific Data structure * for the current thread needs to be * initialized. */ diff --git a/generic/tkPointer.c b/generic/tkPointer.c index 0141b64..6e87638 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -35,7 +35,7 @@ static const unsigned int buttonMasks[] = { }; #define ButtonMask(b) (buttonMasks[(b)-Button1]) -typedef struct ThreadSpecificData { +typedef struct { TkWindow *grabWinPtr; /* Window that defines the top of the grab * tree in a global grab. */ int lastState; /* Last known state flags. */ diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 8ba0c5f..c64c93f 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -48,7 +48,7 @@ typedef struct LostCommand { * The structure below is used to keep each thread's pending list separate. */ -typedef struct ThreadSpecificData { +typedef struct { TkSelInProgress *pendingPtr; /* Topmost search in progress, or NULL if * none. */ diff --git a/generic/tkStyle.c b/generic/tkStyle.c index d9299d1..5c0f204 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -98,7 +98,7 @@ typedef struct Element { * Thread-local data. */ -typedef struct ThreadSpecificData { +typedef struct { int nbInit; /* Number of calls to the init proc. */ Tcl_HashTable engineTable; /* Map a name to a style engine. Keys are * strings, values are Tk_StyleEngine diff --git a/generic/tkWindow.c b/generic/tkWindow.c index ee8e1a9..51cbaf3 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -37,7 +37,7 @@ typedef struct TkHalfdeadWindow { struct TkHalfdeadWindow *nextPtr; } TkHalfdeadWindow; -typedef struct ThreadSpecificData { +typedef struct { int numMainWindows; /* Count of numver of main windows currently * open in this thread. */ TkMainInfo *mainWindowList; diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c index d9203ca..a33a623 100644 --- a/unix/tkUnixEmbed.c +++ b/unix/tkUnixEmbed.c @@ -42,7 +42,7 @@ typedef struct Container { * process. */ } Container; -typedef struct ThreadSpecificData { +typedef struct { Container *firstContainerPtr; /* First in list of all containers managed by * this process. */ diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index cde3791..a92b868 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.c @@ -23,7 +23,7 @@ * the current thread. */ -typedef struct ThreadSpecificData { +typedef struct { int initialized; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 50033ec..f43e086 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -153,7 +153,7 @@ typedef struct FontAttributes { TkXLFDAttributes xa; } FontAttributes; -typedef struct ThreadSpecificData { +typedef struct { FontFamily *fontFamilyList; /* The list of font families that are * currently loaded. As screen fonts are * loaded, this list grows to hold information diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 2430134..10e5aca 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -50,7 +50,7 @@ typedef struct { * the information isn't retrievable from the GC. */ -typedef struct ThreadSpecificData { +typedef struct { Region clipRegion; /* The clipping region, or None. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; @@ -69,7 +69,7 @@ void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - static Tcl_Config cfg[] = { + static const Tcl_Config cfg[] = { { "fontsystem", "xft" }, { 0,0 } }; diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index 6d379ec..dfbb895 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -68,7 +68,7 @@ typedef struct IncrInfo { * currently pending. */ } IncrInfo; -typedef struct ThreadSpecificData { +typedef struct { IncrInfo *pendingIncrs; /* List of all incr structures currently * active. */ } ThreadSpecificData; diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 0b4f05d..1ee4bba 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.c @@ -97,7 +97,7 @@ typedef struct PendingCommand { * NULL means end of list. */ } PendingCommand; -typedef struct ThreadSpecificData { +typedef struct { PendingCommand *pendingCommands; /* List of all commands currently being waited * for. */ diff --git a/win/tkWinButton.c b/win/tkWinButton.c index d03a391..95b4fe4 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -63,7 +63,7 @@ enum { * widget classes. */ -typedef struct ThreadSpecificData { +typedef struct { BITMAPINFOHEADER *boxesPtr; /* Information about the bitmap. */ DWORD *boxesPalette; /* Pointer to color palette. */ LPSTR boxesBits; /* Pointer to bitmap data. */ diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 4ad3b9e..5116352 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -48,7 +48,7 @@ #endif #endif /* BFFM_VALIDATEFAILED */ -typedef struct ThreadSpecificData { +typedef struct { int debugFlag; /* Flags whether we should output debugging * information while displaying a builtin * dialog. */ diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index e13a5e5..4341424 100644 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -103,7 +103,7 @@ const int tkpWinBltModes[] = { typedef BOOL (CALLBACK *WinDrawFunc)(HDC dc, const POINT *points, int npoints); -typedef struct ThreadSpecificData { +typedef struct { POINT *winPoints; /* Array of points that is reused. */ int nWinPoints; /* Current size of point array. */ } ThreadSpecificData; diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index 6c80964..ca293fe 100644 --- a/win/tkWinEmbed.c +++ b/win/tkWinEmbed.c @@ -34,7 +34,7 @@ typedef struct Container { * process. */ } Container; -typedef struct ThreadSpecificData { +typedef struct { Container *firstContainerPtr; /* First in list of all containers managed by * this process. */ diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 6e8d3bd..33392d3 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -168,7 +168,7 @@ static const TkStateMap systemMap[] = { {-1, NULL} }; -typedef struct ThreadSpecificData { +typedef struct { FontFamily *fontFamilyList; /* The list of font families that are * currently loaded. As screen fonts are * loaded, this list grows to hold information diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 3223759..3aa8a61 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -85,7 +85,7 @@ static int indicatorDimensions[2]; static BOOL showMenuAccelerators; -typedef struct ThreadSpecificData { +typedef struct { int inPostMenu; /* We cannot be re-entrant like X Windows. */ WORD lastCommandID; /* The last command ID we allocated. */ HWND menuHWND; /* A window to service popup-menu messages diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index 385e72b..445ff9c 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -13,7 +13,7 @@ #include "tkWinInt.h" #include "tkBusy.h" -typedef struct ThreadSpecificData { +typedef struct { int initialized; /* 0 means table below needs initializing. */ Tcl_HashTable windowTable; /* The windowTable maps from HWND to Tk_Window * handles. */ diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 5bb23d1..37f1dec 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -367,7 +367,7 @@ static const Tk_GeomMgr wmMgrType = { NULL, /* lostSlaveProc */ }; -typedef struct ThreadSpecificData { +typedef struct { HPALETTE systemPalette; /* System palette; refers to the currently * installed foreground logical palette. */ TkWindow *createWindow; /* Window that is being constructed. This diff --git a/win/tkWinX.c b/win/tkWinX.c index e7428e5..fd576a4 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -86,7 +86,7 @@ static Tcl_Encoding unicodeEncoding = NULL; * specific date for threads. */ -typedef struct ThreadSpecificData { +typedef struct { TkDisplay *winDisplay; /* TkDisplay structure that represents Windows * screen. */ int updatingClipboard; /* If 1, we are updating the clipboard. */ -- cgit v0.12