tweaks: recognize the empty string as comment inhibitor, instead of NULL
parent
79971a309f
commit
1439016c20
|
@ -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;
|
||||
|
|
|
@ -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,10 +892,6 @@ 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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue