diff --git a/src/nano.h b/src/nano.h index 77420221644b85e0c4a54387dad26f90832b6c5a..113512f636624ebc0a6d60dc9f953d9997773b96 100644 --- a/src/nano.h +++ b/src/nano.h @@ -220,8 +220,10 @@ typedef struct syntaxtype { /* The command with which to lint this type of file. */ char *formatter; /* The formatting command (for programming languages mainly). */ +#ifdef ENABLE_COMMENT char *comment; /* The line comment prefix (and postfix) for this type of file. */ +#endif colortype *color; /* The colors and their regexes used in this syntax. */ int nmultis; diff --git a/src/rcfile.c b/src/rcfile.c index b19d3f73ce51c2a26130ed420d25957bf1ff1e54..6d7a20be9f81354e387283b37dc4e8899ed8f910 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -317,8 +317,6 @@ void parse_syntax(char *ptr) live_syntax->formatter = NULL; #ifdef ENABLE_COMMENT live_syntax->comment = mallocstrcpy(NULL, GENERAL_COMMENT_CHARACTER); -#else - live_syntax->comment = NULL; #endif live_syntax->color = NULL; lastcolor = NULL; @@ -894,11 +892,7 @@ void pick_up_name(const char *kind, char *ptr, char **storage) *look = '\0'; } - if (*ptr == '\0') { - free(*storage); - *storage = NULL; - } else - *storage = mallocstrcpy(*storage, ptr); + *storage = mallocstrcpy(*storage, ptr); } #endif /* !DISABLE_COLOR */ diff --git a/src/text.c b/src/text.c index 95b540eb5b9a1d814b9e6ed7e7041a89be8c415d..1b9f3a69af1585bfdbdd0c4c5faf40f1d238c3c0 100644 --- a/src/text.c +++ b/src/text.c @@ -470,8 +470,7 @@ void do_comment(void) if (openfile->syntax) comment_seq = openfile->syntax->comment; - /* Does the syntax not allow comments? */ - if (comment_seq == NULL) { + if (*comment_seq == '\0') { statusbar(_("Commenting is not supported for this file type")); return; }