aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2021-12-11 11:28:36 +0000
committerSimon Tatham <anakin@pobox.com>2021-12-11 12:00:37 +0000
commitbb1432c0ad0ba2955df9483dde67a987fb946ed8 (patch)
treede03582f7b8b97f5f7cf0d8519d050cd494998c0
parent57fbcd2b29aa74423d47a9efd783a1508ab1bfc5 (diff)
downloadpuzzles-bb1432c0ad0ba2955df9483dde67a987fb946ed8.zip
puzzles-bb1432c0ad0ba2955df9483dde67a987fb946ed8.tar.gz
puzzles-bb1432c0ad0ba2955df9483dde67a987fb946ed8.tar.bz2
puzzles-bb1432c0ad0ba2955df9483dde67a987fb946ed8.tar.xz
gtk.c: squelch uninitialised-variable warning.
Apparently some compilers can't work out that new_window() will always write to its error-message parameter if it returns failure, so they complain at the call site that 'error' might be used uninitialised. Fix by explicitly initialising it. (To NULL, which really _shouldn't_ stop the compiler from warning, because surely that's just as bad if it reaches the following printf!) Also, while I'm at it, move it into the block where it's used, so it doesn't look as if it might pervade the whole of main().
-rw-r--r--gtk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gtk.c b/gtk.c
index 7710b4e..c3ab732 100644
--- a/gtk.c
+++ b/gtk.c
@@ -3578,7 +3578,6 @@ static void list_presets_from_menu(struct preset_menu *menu)
int main(int argc, char **argv)
{
char *pname = argv[0];
- char *error;
int ngenerate = 0, px = 1, py = 1;
bool print = false;
bool time_generation = false, test_solve = false, list_presets = false;
@@ -3991,6 +3990,7 @@ int main(int argc, char **argv)
} else {
frontend *fe;
bool headless = screenshot_file != NULL;
+ char *error = NULL;
if (!headless)
gtk_init(&argc, &argv);