Commit ed296525 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Eliding the functions parse_header_exp() and parse_magic_exp(),

and reshuffling the parameters in grab_and_store().


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5715 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 837b4e66
Showing with 7 additions and 19 deletions
+7 -19
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
commands for the default syntax. This fixes Savannah bug #47323. commands for the default syntax. This fixes Savannah bug #47323.
* src/rcfile.c (pick_up_name): Fold the parsing of a linter and * src/rcfile.c (pick_up_name): Fold the parsing of a linter and
formatter command into a single routine. formatter command into a single routine.
* src/rcfile.c (parse_header_exp, parse_magic_exp, grab_and_store):
Elide the first two functions, and reshuffle parameters in the last.
2016-03-09 Benno Schulenberg <bensberg@justemail.net> 2016-03-09 Benno Schulenberg <bensberg@justemail.net>
* src/rcfile.c (parse_syntax): Produce an adequate error message * src/rcfile.c (parse_syntax): Produce an adequate error message
......
...@@ -567,7 +567,7 @@ void parse_include(char *ptr); ...@@ -567,7 +567,7 @@ void parse_include(char *ptr);
short color_to_short(const char *colorname, bool *bright); short color_to_short(const char *colorname, bool *bright);
void parse_colors(char *ptr, bool icase); void parse_colors(char *ptr, bool icase);
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright); bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
void grab_and_store(char *ptr, const char *kind, regexlisttype **storage); void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
#endif #endif
void parse_rcfile(FILE *rcstream void parse_rcfile(FILE *rcstream
#ifndef DISABLE_COLOR #ifndef DISABLE_COLOR
......
...@@ -335,7 +335,7 @@ void parse_syntax(char *ptr) ...@@ -335,7 +335,7 @@ void parse_syntax(char *ptr)
/* If there seem to be extension regexes, pick them up. */ /* If there seem to be extension regexes, pick them up. */
if (*ptr != '\0') if (*ptr != '\0')
grab_and_store(ptr, "extension", &endsyntax->extensions); grab_and_store("extension", ptr, &endsyntax->extensions);
} }
#endif /* !DISABLE_COLOR */ #endif /* !DISABLE_COLOR */
...@@ -801,7 +801,7 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright) ...@@ -801,7 +801,7 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
/* Read regex strings enclosed in double quotes from the line pointed at /* Read regex strings enclosed in double quotes from the line pointed at
* by ptr, and store them quoteless in the passed storage place. */ * by ptr, and store them quoteless in the passed storage place. */
void grab_and_store(char *ptr, const char *kind, regexlisttype **storage) void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
{ {
regexlisttype *lastthing; regexlisttype *lastthing;
...@@ -863,20 +863,6 @@ void grab_and_store(char *ptr, const char *kind, regexlisttype **storage) ...@@ -863,20 +863,6 @@ void grab_and_store(char *ptr, const char *kind, regexlisttype **storage)
} }
} }
/* Parse the header-line regexes that may influence the choice of syntax. */
void parse_header_exp(char *ptr)
{
grab_and_store(ptr, "header", &endsyntax->headers);
}
#ifdef HAVE_LIBMAGIC
/* Parse the magic regexes that may influence the choice of syntax. */
void parse_magic_exp(char *ptr)
{
grab_and_store(ptr, "magic", &endsyntax->magics);
}
#endif /* HAVE_LIBMAGIC */
/* Parse and store the name given after a linter/formatter command. */ /* Parse and store the name given after a linter/formatter command. */
void pick_up_name(const char *kind, char *ptr, char **storage) void pick_up_name(const char *kind, char *ptr, char **storage)
{ {
...@@ -1032,12 +1018,12 @@ void parse_rcfile(FILE *rcstream ...@@ -1032,12 +1018,12 @@ void parse_rcfile(FILE *rcstream
} }
else if (strcasecmp(keyword, "magic") == 0) else if (strcasecmp(keyword, "magic") == 0)
#ifdef HAVE_LIBMAGIC #ifdef HAVE_LIBMAGIC
parse_magic_exp(ptr); grab_and_store("magic", ptr, &endsyntax->magics);
#else #else
; ;
#endif #endif
else if (strcasecmp(keyword, "header") == 0) else if (strcasecmp(keyword, "header") == 0)
parse_header_exp(ptr); grab_and_store("header", ptr, &endsyntax->headers);
else if (strcasecmp(keyword, "color") == 0) else if (strcasecmp(keyword, "color") == 0)
parse_colors(ptr, FALSE); parse_colors(ptr, FALSE);
else if (strcasecmp(keyword, "icolor") == 0) else if (strcasecmp(keyword, "icolor") == 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment