From fe1d0722d41f2f0edafcde9ac255dc0f38775b33 Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Thu, 13 Feb 2003 00:52:49 +0000 Subject: [PATCH] - nano.c:main() - Silence annoying compiler messages about clobbering and uninitialized variables by moving variable inits to the top of main() and re-initializing them after the sigsetjmp() git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1456 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 6 ++++-- nano.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e93f15c3..b9dedf2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,8 +15,7 @@ CVS code nano.c:do_spell(), and search.c:do_replace() (David Benbennick). - Change various const char *s to char *s because Irix curses waddnstr() complains about const char's, I imagine this is a - common System V curses issue. - + common System V curses issue. - files.c: cwd_tab_completion() - Memory leak fix (David Benbennick). @@ -46,6 +45,9 @@ CVS code main() - Fix nano not compiling with ENABLE_RCFILE and DISABLE_TABCOMP (David Benbennick). + - Silence annoying compiler messages about clobbering and + uninitialized variables by moving variable inits to the top + of main() and re-initializing them after the sigsetjmp(). - rcfile.c: colortoint() - Don't bomb after invalid color and print bad color name diff --git a/nano.c b/nano.c index 905b192f..04246e24 100644 --- a/nano.c +++ b/nano.c @@ -3019,9 +3019,12 @@ int main(int argc, char *argv[]) { int optchr; int startline = 0; /* Line to try and start at */ - int modify_control_seq; + int modify_control_seq = 0; int fill_flag_used = 0; /* Was the fill option used? */ const shortcut *s; + int keyhandled = 0; /* Have we handled the keystroke yet? */ + int kbinput = -1; /* Input from keyboard */ + #ifdef HAVE_GETOPT_LONG int preserveopt = 0; /* Did the cmdline include --preserve? */ #endif @@ -3471,6 +3474,11 @@ int main(int argc, char *argv[]) /* Return here after a sigwinch */ sigsetjmp(jmpbuf, 1); + /* SHUT UP GCC! */ + startline = 0; + fill_flag_used = 0; + keyhandled = 0; + /* This variable should be initialized after the sigsetjmp(), so we can't do Esc-Esc then quickly resize and muck things up. */ modify_control_seq = 0; @@ -3479,8 +3487,6 @@ int main(int argc, char *argv[]) reset_cursor(); while (1) { - int keyhandled = 0; /* Have we handled the keystroke yet? */ - int kbinput; /* Input from keyboard */ if (ISSET(CONSTUPDATE)) do_cursorpos(1); -- 2.39.5