Commit 1439016c authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

tweaks: recognize the empty string as comment inhibitor, instead of NULL

No related merge requests found
Showing with 4 additions and 9 deletions
+4 -9
...@@ -220,8 +220,10 @@ typedef struct syntaxtype { ...@@ -220,8 +220,10 @@ typedef struct syntaxtype {
/* The command with which to lint this type of file. */ /* The command with which to lint this type of file. */
char *formatter; char *formatter;
/* The formatting command (for programming languages mainly). */ /* The formatting command (for programming languages mainly). */
#ifdef ENABLE_COMMENT
char *comment; char *comment;
/* The line comment prefix (and postfix) for this type of file. */ /* The line comment prefix (and postfix) for this type of file. */
#endif
colortype *color; colortype *color;
/* The colors and their regexes used in this syntax. */ /* The colors and their regexes used in this syntax. */
int nmultis; int nmultis;
......
...@@ -317,8 +317,6 @@ void parse_syntax(char *ptr) ...@@ -317,8 +317,6 @@ void parse_syntax(char *ptr)
live_syntax->formatter = NULL; live_syntax->formatter = NULL;
#ifdef ENABLE_COMMENT #ifdef ENABLE_COMMENT
live_syntax->comment = mallocstrcpy(NULL, GENERAL_COMMENT_CHARACTER); live_syntax->comment = mallocstrcpy(NULL, GENERAL_COMMENT_CHARACTER);
#else
live_syntax->comment = NULL;
#endif #endif
live_syntax->color = NULL; live_syntax->color = NULL;
lastcolor = NULL; lastcolor = NULL;
...@@ -894,11 +892,7 @@ void pick_up_name(const char *kind, char *ptr, char **storage) ...@@ -894,11 +892,7 @@ void pick_up_name(const char *kind, char *ptr, char **storage)
*look = '\0'; *look = '\0';
} }
if (*ptr == '\0') { *storage = mallocstrcpy(*storage, ptr);
free(*storage);
*storage = NULL;
} else
*storage = mallocstrcpy(*storage, ptr);
} }
#endif /* !DISABLE_COLOR */ #endif /* !DISABLE_COLOR */
......
...@@ -470,8 +470,7 @@ void do_comment(void) ...@@ -470,8 +470,7 @@ void do_comment(void)
if (openfile->syntax) if (openfile->syntax)
comment_seq = openfile->syntax->comment; comment_seq = openfile->syntax->comment;
/* Does the syntax not allow comments? */ if (*comment_seq == '\0') {
if (comment_seq == NULL) {
statusbar(_("Commenting is not supported for this file type")); statusbar(_("Commenting is not supported for this file type"));
return; return;
} }
......
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