From 3cb80ff7ea0dd4eb1eb25ddad58c8b8ac06f7953 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 12 Mar 2016 09:43:10 +0000 Subject: [PATCH] Renaming two functions, to be more distinguishable -- a leading underscore as the only difference is not enough. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5726 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/proto.h | 2 +- src/rcfile.c | 17 ++++++++--------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1774057e..e25e1a4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2016-03-12 Benno Schulenberg * src/color.c (color_update): Set the syntax and regex pointers just once, in a single place. And unnest two 'if's. + * src/rcfile.c (parse_one_include, parse_includes): New names for + these functions, to be more distinguishable. 2016-03-11 Benno Schulenberg * src/browser.c (do_browser): Fix compilation when configured with diff --git a/src/proto.h b/src/proto.h index 39ab19f1..1090db45 100644 --- a/src/proto.h +++ b/src/proto.h @@ -563,7 +563,7 @@ char *parse_argument(char *ptr); char *parse_next_regex(char *ptr); bool nregcomp(const char *regex, int eflags); void parse_syntax(char *ptr); -void parse_include(char *ptr); +void parse_includes(char *ptr); short color_to_short(const char *colorname, bool *bright); void parse_colors(char *ptr, bool icase); bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright); diff --git a/src/rcfile.c b/src/rcfile.c index 5b86c362..c3eeccb1 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -514,10 +514,9 @@ void parse_binding(char *ptr, bool dobind) free(keycopy); } - #ifndef DISABLE_COLOR -/* Read and parse additional syntax files. */ -static void _parse_include(char *file) +/* Read and parse one included syntax file. */ +static void parse_one_include(char *file) { struct stat rcinfo; FILE *rcstream; @@ -555,7 +554,8 @@ static void _parse_include(char *file) parse_rcfile(rcstream, TRUE); } -void parse_include(char *ptr) +/* Expand globs in the passed name, and parse the resultant files. */ +void parse_includes(char *ptr) { char *option, *nanorc_save = nanorc, *expanded; size_t lineno_save = lineno, i; @@ -571,16 +571,15 @@ void parse_include(char *ptr) if (glob(expanded, GLOB_ERR|GLOB_NOSORT, NULL, &files) == 0) { for (i = 0; i < files.gl_pathc; ++i) - _parse_include(files.gl_pathv[i]); - } else { + parse_one_include(files.gl_pathv[i]); + } else rcfile_error(_("Error expanding %s: %s"), option, strerror(errno)); - } globfree(&files); free(expanded); - /* We're done with the new syntax file. Restore the original + /* We're done with the included file(s). Restore the original * filename and line number position. */ nanorc = nanorc_save; lineno = lineno_save; @@ -995,7 +994,7 @@ void parse_rcfile(FILE *rcstream rcfile_error(N_("Command \"%s\" not allowed in included file"), keyword); else - parse_include(ptr); + parse_includes(ptr); } else if (strcasecmp(keyword, "syntax") == 0) { if (opensyntax && endcolor == NULL) rcfile_error(N_("Syntax \"%s\" has no color commands"), -- 2.39.5