From e4c34c33868eb068de163ad42f71cb6b663a14c7 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 17 Mar 2014 14:15:57 +0000 Subject: [PATCH] Adding, fixing, and removing some #endif comments. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4649 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/color.c | 4 ++-- src/cut.c | 9 +-------- src/files.c | 10 +++++----- src/global.c | 12 ++++++------ src/help.c | 1 - src/nano.c | 4 ++-- src/nano.h | 7 +------ src/proto.h | 3 --- src/search.c | 8 ++++---- src/text.c | 2 +- src/utils.c | 2 +- 12 files changed, 26 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index d7a558db..7f6e1d42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ and newlines, condense three statements into one, place an #endif better, melt two #ifndefs into one, and add a comment. * src/winio.c (edit_scroll) - Remove the old softwrap scrolling code. + * src/{nano.h,proto.h,color.c,cut.c,files.c,global.c,help.c,nano.c, + search.c,text.c,utils.c} - Add, fix, and remove some #endif comments, + remove an obsolete comment, and remove some superfluous #ifndefs. 2014-03-16 Benno Schulenberg * src/nano.h - Display more help items when the terminal is wider. diff --git a/src/color.c b/src/color.c index 40281808..8abef6cf 100644 --- a/src/color.c +++ b/src/color.c @@ -229,7 +229,7 @@ void color_update(void) #ifdef DEBUG fprintf(stderr, "No match using extension, trying libmagic...\n"); -#endif /* DEBUG */ +#endif for (tmpsyntax = syntaxes; tmpsyntax != NULL; tmpsyntax = tmpsyntax->next) { @@ -241,7 +241,7 @@ void color_update(void) } #ifdef DEBUG fprintf(stderr,"Matching regex \"%s\" against \"%s\"\n",e->ext_regex, magicstring); -#endif /* DEBUG */ +#endif if (magicstring && regexec(e->ext, magicstring, 0, NULL, 0) == 0) { openfile->syntax = tmpsyntax; diff --git a/src/cut.c b/src/cut.c index d4f29b37..9ec8787c 100644 --- a/src/cut.c +++ b/src/cut.c @@ -162,7 +162,6 @@ void do_cut_text( keep_cutbuffer = TRUE; #ifndef NANO_TINY - if (cut_till_end) { /* If cut_till_end is TRUE, move all text up to the end of the * file into the cutbuffer. */ @@ -209,14 +208,10 @@ void do_cut_text( /* Leave the text in the cutbuffer, and mark the file as * modified. */ -#ifndef NANO_TINY if (!copy_text) { -#endif set_modified(); -#ifndef NANO_TINY } -#endif -#endif +#endif /* !NANO_TINY */ /* Update the screen. */ edit_refresh_needed = TRUE; @@ -254,9 +249,7 @@ void do_copy_text(void) /* Cut from the current cursor position to the end of the file. */ void do_cut_till_end(void) { -#ifndef NANO_TINY add_undo(CUT); -#endif do_cut_text(FALSE, TRUE, FALSE); } #endif /* !NANO_TINY */ diff --git a/src/files.c b/src/files.c index 914c6e28..9faa3262 100644 --- a/src/files.c +++ b/src/files.c @@ -211,7 +211,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi #ifdef DEBUG fprintf(stderr, "In write_lockfile(), write successful (wrote %d bytes)\n", wroteamt); -#endif /* DEBUG */ +#endif if (fclose(filestream) == EOF) { statusbar(_("Error writing lock file %s: %s"), @@ -260,7 +260,7 @@ int do_lockfile(const char *filename) locking_prefix, lockbase, locking_suffix); #ifdef DEBUG fprintf(stderr, "lock file name is %s\n", lockfilename); -#endif /* DEBUG */ +#endif if (stat(lockfilename, &fileinfo) != -1) { ssize_t readtot = 0; ssize_t readamt = 0; @@ -291,7 +291,7 @@ int do_lockfile(const char *filename) lockprog); fprintf(stderr, "user which created this lock file should be %s\n", lockuser); -#endif /* DEBUG */ +#endif sprintf(promptstr, "File being edited (by %s, PID %d, user %s), continue?", lockprog, lockpid, lockuser); ans = do_yesno_prompt(FALSE, promptstr); @@ -303,7 +303,7 @@ int do_lockfile(const char *filename) return write_lockfile(lockfilename, filename, FALSE); } -#endif /* NANO_TINY */ +#endif /* !NANO_TINY */ /* If it's not "", filename is a file to open. We make a new buffer, if @@ -1626,7 +1626,7 @@ void init_backup_dir(void) backup_dir = full_backup_dir; } } -#endif +#endif /* !NANO_TINY */ /* Read from inn, write to out. We assume inn is opened for reading, * and out for writing. We return 0 on success, -1 on read error, or -2 diff --git a/src/global.c b/src/global.c index 17a33040..b84be91f 100644 --- a/src/global.c +++ b/src/global.c @@ -800,7 +800,7 @@ void shortcut_init(bool unjustify) #ifndef NANO_TINY add_to_funcs(do_research, MBROWSER, whereis_next_msg, IFSCHELP(nano_whereis_next_msg), TRUE, VIEW); -#endif /* NANO_TINY */ +#endif #ifndef DISABLE_JUSTIFY /* TRANSLATORS: Try to keep this at most 10 characters. */ @@ -901,7 +901,7 @@ void shortcut_init(bool unjustify) add_to_funcs(do_redo, MMAIN, N_("Redo"), IFSCHELP(nano_redo_msg), TRUE, NOVIEW); } -#endif +#endif /* !NANO_TINY */ add_to_funcs(do_right, MMAIN, N_("Forward"), IFSCHELP(nano_forward_msg), FALSE, VIEW); @@ -1106,7 +1106,7 @@ void shortcut_init(bool unjustify) add_to_funcs(new_buffer_void, MEXTCMD, new_buffer_msg, IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW); #endif -#endif /* NANO_TINY */ +#endif /* !NANO_TINY */ #ifndef DISABLE_HELP add_to_funcs(edit_refresh, MHELP, @@ -1283,7 +1283,7 @@ void shortcut_init(bool unjustify) add_to_sclist(MMAIN, "M-N", do_toggle_void, NO_CONVERT, TRUE); add_to_sclist(MMAIN, "M-Z", do_toggle_void, SUSPEND, TRUE); add_to_sclist(MMAIN, "M-$", do_toggle_void, SOFTWRAP, TRUE); -#endif /* NANO_TINY */ +#endif /* !NANO_TINY */ add_to_sclist(MHELP|MBROWSER, "^C", do_exit, 0, TRUE); add_to_sclist(MHELP, "^G", do_exit, 0, TRUE); @@ -1386,7 +1386,7 @@ const char *flagtostr(int flag) return "?????"; } } -#endif /* NANO_TINY */ +#endif /* !NANO_TINY */ /* Interpret the string given by the rc file and return a * shortcut struct, complete with proper value for execute. */ @@ -1550,7 +1550,7 @@ sc *strtosc(int menu, char *input) s->execute = FALSE; s->toggle = SUSPEND; } -#endif /* NANO_TINY */ +#endif /* !NANO_TINY */ else if (!strcasecmp(input, "right") || !strcasecmp(input, "forward")) s->scfunc = do_right; diff --git a/src/help.c b/src/help.c index d7b58838..c492c274 100644 --- a/src/help.c +++ b/src/help.c @@ -482,7 +482,6 @@ void help_init(void) ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n", s->keystr, _(flagtostr(s->toggle)), _("enable/disable")); - #ifdef ENABLE_NANORC if (old_whitespace) SET(WHITESPACE_DISPLAY); diff --git a/src/nano.c b/src/nano.c index 884b05a2..8665c3c1 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1077,7 +1077,7 @@ void do_exit(void) #ifndef NANO_TINY if (ISSET(LOCKING) && openfile->lock_filename) delete_lockfile(openfile->lock_filename); -#endif /* NANO_TINY */ +#endif #ifdef ENABLE_MULTIBUFFER /* Exit only if there are no more open file buffers. */ @@ -2501,7 +2501,7 @@ int main(int argc, char **argv) load_poshistory(); } #endif /* ENABLE_NANORC */ -#endif /* NANO_TINY */ +#endif /* !NANO_TINY */ #ifndef NANO_TINY /* Set up the backup directory (unless we're using restricted mode, diff --git a/src/nano.h b/src/nano.h index 53fc4b36..06d0cf66 100644 --- a/src/nano.h +++ b/src/nano.h @@ -352,7 +352,7 @@ typedef struct poshiststruct { struct poshiststruct *next; } poshiststruct; -#endif /* NANO_TINY */ +#endif /* !NANO_TINY */ typedef struct openfilestruct { @@ -784,11 +784,6 @@ enum #define UNdel_backspace (1<<1) #define UNsplit_madenew (1<<2) -/* Since in ISO C you can't pass around function pointers anymore, - let's make some integer macros for function names, and then I - can go cut my wrists after writing the big switch statement - that will necessitate. */ - #endif /* !NANO_TINY */ #define VIEW TRUE diff --git a/src/proto.h b/src/proto.h index 6f26c0e8..831f7481 100644 --- a/src/proto.h +++ b/src/proto.h @@ -255,7 +255,6 @@ void do_cut_text_void(void); #ifndef NANO_TINY void do_copy_text(void); void do_cut_till_end(void); - #endif void do_uncut_text(void); @@ -472,8 +471,6 @@ RETSIGTYPE do_continue(int signal); #ifndef NANO_TINY RETSIGTYPE handle_sigwinch(int signal); void allow_pending_sigwinch(bool allow); -#endif -#ifndef NANO_TINY void do_toggle(int flag); void do_toggle_void(void); #endif diff --git a/src/search.c b/src/search.c index 137df5e2..a05de7e0 100644 --- a/src/search.c +++ b/src/search.c @@ -573,7 +573,7 @@ void do_research(void) openfile->current_x && !didfind) statusbar(_("This is the only occurrence")); } else { -#endif +#endif /* HAVE_REGEX_H */ statusbar(_("This is the only occurrence")); #ifdef HAVE_REGEX_H } @@ -586,7 +586,7 @@ void do_research(void) edit_redraw(fileptr, pww_save); search_replace_abort(); } -#endif +#endif /* !NANO_TINY */ #ifdef HAVE_REGEX_H int replace_regexp(char *string, bool create) @@ -636,7 +636,7 @@ int replace_regexp(char *string, bool create) return new_line_size; } -#endif +#endif /* HAVE_REGEX_H */ char *replace_line(const char *needle) { @@ -724,7 +724,7 @@ ssize_t do_replace_loop( #endif edit_refresh(); } -#endif +#endif /* !NANO_TINY */ if (canceled != NULL) *canceled = FALSE; diff --git a/src/text.c b/src/text.c index ef022f37..57e619c2 100644 --- a/src/text.c +++ b/src/text.c @@ -3228,7 +3228,7 @@ void do_linter(void) openfile = tmpof; } } -#endif /* NANO_TINY */ +#endif /* !NANO_TINY */ do_gotolinecolumn(curlint->lineno, tmpcol, FALSE, FALSE, FALSE, FALSE); titlebar(NULL); edit_refresh(); diff --git a/src/utils.c b/src/utils.c index 044488af..9f258f3f 100644 --- a/src/utils.c +++ b/src/utils.c @@ -598,7 +598,7 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct *right_side_up = FALSE; } } -#endif +#endif /* !NANO_TINY */ /* Calculate the number of characters between begin and end, and return * it. */