From d689479c933e288ddeafe93bd23e08836b79507e Mon Sep 17 00:00:00 2001 From: marc_culler Date: Wed, 16 Dec 2020 16:50:56 +0000 Subject: Tidy up with a patch from Christopher Chavez. Removes redundant include directives and double semicolons. Uses nil instead of NULL for references to NSObjects in Objective C. --- generic/tkMain.c | 8 -------- generic/ttk/ttkCache.c | 1 - generic/ttk/ttkElements.c | 1 - generic/ttk/ttkImage.c | 1 - generic/ttk/ttkInit.c | 1 - generic/ttk/ttkLayout.c | 1 - generic/ttk/ttkManager.c | 1 - generic/ttk/ttkNotebook.c | 3 --- generic/ttk/ttkPanedwindow.c | 1 - generic/ttk/ttkProgress.c | 1 - generic/ttk/ttkScale.c | 2 -- generic/ttk/ttkState.c | 1 - generic/ttk/ttkTagSet.c | 1 - generic/ttk/ttkTreeview.c | 2 -- generic/ttk/ttkWidget.c | 1 - macosx/tkMacOSXColor.c | 4 ++-- macosx/tkMacOSXCursor.c | 4 ++-- macosx/tkMacOSXImage.c | 10 +++++----- macosx/tkMacOSXKeyEvent.c | 2 +- macosx/tkMacOSXNotify.c | 2 +- macosx/ttkMacOSXTheme.c | 3 +-- tests/butGeom2.tcl | 2 +- unix/tkUnixRFont.c | 1 - 23 files changed, 13 insertions(+), 41 deletions(-) diff --git a/generic/tkMain.c b/generic/tkMain.c index 32006b3..953a54f 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -15,14 +15,6 @@ */ #include "tkInt.h" -#include -#include -#include -#ifdef NO_STDLIB_H -# include "../compat/stdlib.h" -#else -# include -#endif extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *); diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c index e7f885f..c29007c 100644 --- a/generic/ttk/ttkCache.c +++ b/generic/ttk/ttkCache.c @@ -28,7 +28,6 @@ * but this will be a transient effect. */ -#include /* for sprintf */ #include "tkInt.h" #include "ttkTheme.h" diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index c4469dc..4dd2adb 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -6,7 +6,6 @@ */ #include "tkInt.h" -#include #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index 5c2a55f..2ef30e0 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -10,7 +10,6 @@ * [style map]. */ -#include #include "tkInt.h" #include "ttkTheme.h" diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index f1b6e26..0bda18b 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -4,7 +4,6 @@ * Ttk package: initialization routine and miscellaneous utilities. */ -#include #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index fdbeacf..ed61a1c 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -6,7 +6,6 @@ * Copyright (c) 2003 Joe English. Freely redistributable. */ -#include #include "tkInt.h" #include "ttkThemeInt.h" diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index 8cad58c..a47d8dc 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -4,7 +4,6 @@ * Support routines for geometry managers. */ -#include #include "tkInt.h" #include "ttkManager.h" diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 83075bc..ea82ef1 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -3,9 +3,6 @@ */ #include "tkInt.h" -#include -#include -#include #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index fa0d5c8..4fbbf94 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -6,7 +6,6 @@ * TODO: track active/pressed sash. */ -#include #include "tkInt.h" #include "ttkManager.h" #include "ttkTheme.h" diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index 42da84d..f65cb08 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -4,7 +4,6 @@ * ttk::progressbar widget. */ -#include #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index 4d05f97..a4b2a4e 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -4,8 +4,6 @@ * ttk::scale widget. */ -#include -#include #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c index d37f7f6..9e5cf4b 100644 --- a/generic/ttk/ttkState.c +++ b/generic/ttk/ttkState.c @@ -5,7 +5,6 @@ * */ -#include #include "tkInt.h" #include "ttkTheme.h" diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c index fc026cb..0ce5cea 100644 --- a/generic/ttk/ttkTagSet.c +++ b/generic/ttk/ttkTagSet.c @@ -4,7 +4,6 @@ * Copyright (C) 2005, Joe English. Freely redistributable. */ -#include /* for memset() */ #include "tkInt.h" #include "ttkTheme.h" diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 0a156a5..41b05e5 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -4,8 +4,6 @@ * ttk::treeview widget implementation. */ -#include -#include #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 9992d27..0cfc119 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -4,7 +4,6 @@ * Core widget utilities. */ -#include #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 99606e0..edcd5d3 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -547,7 +547,7 @@ TkMacOSXSetColorInContext( CGColorRef cgColor = nil; SystemColorDatum *entry = GetEntryFromPixel(pixel); CGRect rect; - HIThemeBackgroundDrawInfo info = {0, kThemeStateActive, 0};; + HIThemeBackgroundDrawInfo info = {0, kThemeStateActive, 0}; if (entry) { switch (entry->type) { @@ -619,7 +619,7 @@ TkpGetColor( Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap; NSView *view = nil; static Bool initialized = NO; - static NSColorSpace* sRGB = NULL; + static NSColorSpace* sRGB = nil; if (!initialized) { initialized = YES; diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 4b2de7f..191aa7e 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -271,7 +271,7 @@ FindCursorByName( break; case IMAGEBITMAP: { unsigned char *bitmap = (unsigned char *)(cursorNames[idx].id1); - NSBitmapImageRep *bitmapImageRep = NULL; + NSBitmapImageRep *bitmapImageRep = nil; CGImageRef img = NULL, mask = NULL, maskedImg = NULL; static const CGFloat decodeWB[] = {1, 0}; CGColorSpaceRef colorspace = CGColorSpaceCreateWithName( @@ -466,7 +466,7 @@ TkpFreeCursor( TkMacOSXCursor *macCursorPtr = (TkMacOSXCursor *) cursorPtr; [macCursorPtr->macCursor release]; - macCursorPtr->macCursor = NULL; + macCursorPtr->macCursor = nil; if (macCursorPtr == gCurrentCursor) { gCurrentCursor = NULL; } diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c index 2604dfa..74c0115 100644 --- a/macosx/tkMacOSXImage.c +++ b/macosx/tkMacOSXImage.c @@ -414,7 +414,7 @@ XPutImage( int dest_x, /* Destination X & Y. */ int dest_y, unsigned int width, /* Same width & height for both */ - unsigned int height) /* distination and source. */ + unsigned int height) /* destination and source. */ { TkMacOSXDrawingContext dc; MacDrawable *macDraw = (MacDrawable *)drawable; @@ -529,8 +529,8 @@ CreateCGImageFromDrawableRect( MacDrawable *mac_drawable = (MacDrawable *)drawable; CGContextRef cg_context = NULL; CGImageRef cg_image = NULL, result = NULL; - NSBitmapImageRep *bitmapRep = NULL; - NSView *view = NULL; + NSBitmapImageRep *bitmapRep = nil; + NSView *view = nil; if (mac_drawable->flags & TK_IS_PIXMAP) { /* * This MacDrawable is a bitmap, so its view is NULL. @@ -544,7 +544,7 @@ CreateCGImageFromDrawableRect( result = CGImageCreateWithImageInRect(cg_image, image_rect); CGImageRelease(cg_image); } - } else if (TkMacOSXGetNSViewForDrawable(mac_drawable) != NULL) { + } else if (TkMacOSXGetNSViewForDrawable(mac_drawable) != nil) { /* * Convert Tk top-left to NSView bottom-left coordinates. @@ -642,7 +642,7 @@ XGetImage( unsigned long plane_mask, int format) { - NSBitmapImageRep* bitmapRep = NULL; + NSBitmapImageRep* bitmapRep = nil; NSUInteger bitmap_fmt = 0; XImage* imagePtr = NULL; char* bitmap = NULL; diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index fdf4e66..1dc3982 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -268,7 +268,7 @@ static NSUInteger textInputModifiers; @implementation TKContentView @synthesize tkDirtyRect = _tkDirtyRect; -@synthesize tkNeedsDisplay = _tkNeedsDisplay;; +@synthesize tkNeedsDisplay = _tkNeedsDisplay; /* * Implementation of the NSTextInputClient protocol. diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index b32c635..343c245 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -333,7 +333,7 @@ TkMacOSXNotifyExitHandler( * None. * * Side effects: - * Parts of windows my get redrawn. + * Parts of windows may get redrawn. * *---------------------------------------------------------------------- */ diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index a723408..ea65e2d 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -31,7 +31,6 @@ #include "tkMacOSXPrivate.h" #include "ttk/ttkTheme.h" -#include /* * Macros for handling drawing contexts. @@ -2886,7 +2885,7 @@ static Ttk_ElementSpec ToolbarBackgroundElementSpec = { * +++ Field elements -- * * Used for the Treeview widget. This is like the BackgroundElement - * except that the fieldbackground color is configureable. + * except that the fieldbackground color is configurable. */ typedef struct { diff --git a/tests/butGeom2.tcl b/tests/butGeom2.tcl index 096225c..844f912 100644 --- a/tests/butGeom2.tcl +++ b/tests/butGeom2.tcl @@ -8,7 +8,7 @@ wm iconname .t "Button Geometry" wm geom .t +0+0 wm minsize .t 1 1 -label .t.l -text {This screen exercises the color options for various flavors of buttons. Select display options below, and they will be applied to the appropiate button widgets.} -wraplength 5i +label .t.l -text {This screen exercises the color options for various flavors of buttons. Select display options below, and they will be applied to the appropriate button widgets.} -wraplength 5i pack .t.l -side top -fill both button .t.quit -text Quit -command {destroy .t} diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 340b5a9..226445c 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -12,7 +12,6 @@ #include "tkUnixInt.h" #include "tkFont.h" #include -#include #define MAX_CACHED_COLORS 16 -- cgit v0.12