From: Benno Schulenberg Date: Fri, 3 Apr 2015 17:28:30 +0000 (+0000) Subject: Ignoring magic without libmagic, and ignoring formatter without spell checking. X-Git-Tag: v2.4.1~22 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=d7ade1f346953c2887ceb562f09dd383dbb1d336;p=nano.git Ignoring magic without libmagic, and ignoring formatter without spell checking. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5175 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 3b508090..fc40ef36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2015-04-03 Benno Schulenberg - * README: Update text to the fifth milestone: 2.4.x, plus tweaks. + * README: Update text to the fifth milestone, 2.4.x, plus tweaks. * src/rcfile.c: Remove two superfluous (because nested) #ifndefs. + * src/rcfile.c (parse_rcfile): Ignore any magic when libmagic was + disabled, and ignore a formatter when spell checking was disabled. 2015-03-28 Benno Schulenberg * src/search.c (search_init_globals, search_replace_abort), diff --git a/src/rcfile.c b/src/rcfile.c index 51ff6bb9..d8baeca0 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -903,10 +903,10 @@ void parse_header_exp(char *ptr) } } +#ifdef HAVE_LIBMAGIC /* Parse the magic regexes that may influence the choice of syntax. */ void parse_magic_exp(char *ptr) { -#ifdef HAVE_LIBMAGIC regexlisttype *endmagic = NULL; assert(ptr != NULL); @@ -966,8 +966,8 @@ void parse_magic_exp(char *ptr) } else free(newmagic); } -#endif /* HAVE_LIBMAGIC */ } +#endif /* HAVE_LIBMAGIC */ /* Parse the linter requested for this syntax. */ void parse_linter(char *ptr) @@ -995,6 +995,7 @@ void parse_linter(char *ptr) endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr); } +#ifndef DISABLE_SPELLER /* Parse the formatter requested for this syntax. */ void parse_formatter(char *ptr) { @@ -1020,6 +1021,7 @@ void parse_formatter(char *ptr) else endsyntax->formatter = mallocstrcpy(syntaxes->formatter, ptr); } +#endif /* !DISABLE_SPELLER */ #endif /* !DISABLE_COLOR */ /* Check whether the user has unmapped every shortcut for a @@ -1146,7 +1148,11 @@ void parse_rcfile(FILE *rcstream parse_syntax(ptr); } else if (strcasecmp(keyword, "magic") == 0) +#ifdef HAVE_LIBMAGIC parse_magic_exp(ptr); +#else + ; +#endif else if (strcasecmp(keyword, "header") == 0) parse_header_exp(ptr); else if (strcasecmp(keyword, "color") == 0) @@ -1156,7 +1162,11 @@ void parse_rcfile(FILE *rcstream else if (strcasecmp(keyword, "linter") == 0) parse_linter(ptr); else if (strcasecmp(keyword, "formatter") == 0) +#ifndef DISABLE_SPELLER parse_formatter(ptr); +#else + ; +#endif #endif /* !DISABLE_COLOR */ else if (strcasecmp(keyword, "bind") == 0) parse_binding(ptr, TRUE);