mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Fix missing statics and #includes on variables.
After Ben fixed all the unwanted global functions by using gcc's -Wmissing-declarations to spot any that were not predeclared, I remembered that clang has -Wmissing-variable-declarations, which does the same job for global objects. Enabled it in -DSTRICT=ON, and made the code clean under it. Mostly this was just a matter of sticking 'static' on the front of things. One variable was outright removed ('verbose' in signpost.c) because after I made it static clang was then able to spot that it was also unused. The more interesting cases were the ones where declarations had to be _added_ to header files. In particular, in COMBINED builds, puzzles.h now arranges to have predeclared each 'game' structure defined by a puzzle backend. Also there's a new tiny header file gtk.h, containing the declarations of xpm_icons and n_xpm_icons which are exported by each puzzle's autogenerated icon source file and by no-icon.c. Happily even the real XPM icon files were generated by our own Perl script rather than being raw xpm output from ImageMagick, so there was no difficulty adding the corresponding #include in there.
This commit is contained in:
10
gtk.c
10
gtk.c
@ -30,6 +30,7 @@
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#include "puzzles.h"
|
||||
#include "gtk.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,0,0)
|
||||
# define USE_PANGO
|
||||
@ -2391,8 +2392,8 @@ static void menu_preset_event(GtkMenuItem *menuitem, gpointer data)
|
||||
midend_redraw(fe->me);
|
||||
}
|
||||
|
||||
GdkAtom compound_text_atom, utf8_string_atom;
|
||||
bool paste_initialised = false;
|
||||
static GdkAtom compound_text_atom, utf8_string_atom;
|
||||
static bool paste_initialised = false;
|
||||
|
||||
static void set_selection(frontend *fe, GdkAtom selection)
|
||||
{
|
||||
@ -3076,9 +3077,6 @@ static void menu_about_event(GtkMenuItem *menuitem, gpointer data)
|
||||
"version", ver, \
|
||||
"comments", "Part of Simon Tatham's Portable Puzzle Collection"
|
||||
|
||||
extern char *const *const xpm_icons[];
|
||||
extern const int n_xpm_icons;
|
||||
|
||||
if (n_xpm_icons) {
|
||||
GdkPixbuf *icon = gdk_pixbuf_new_from_xpm_data
|
||||
((const gchar **)xpm_icons[0]);
|
||||
@ -3193,8 +3191,6 @@ static frontend *new_window(
|
||||
GList *iconlist;
|
||||
int x, y, n;
|
||||
char errbuf[1024];
|
||||
extern char *const *const xpm_icons[];
|
||||
extern const int n_xpm_icons;
|
||||
struct preset_menu *preset_menu;
|
||||
|
||||
fe = snew(frontend);
|
||||
|
Reference in New Issue
Block a user