tweaks: remove a handful of redundant (because always true) asserts
And rewrap some lines, three of them to make them equal to another.master
parent
37e9ada964
commit
13f8ddcaf2
27
src/rcfile.c
27
src/rcfile.c
|
@ -215,19 +215,14 @@ char *parse_argument(char *ptr)
|
||||||
* null-terminate it, and return a pointer to the /next/ word. */
|
* null-terminate it, and return a pointer to the /next/ word. */
|
||||||
char *parse_next_regex(char *ptr)
|
char *parse_next_regex(char *ptr)
|
||||||
{
|
{
|
||||||
assert(ptr != NULL);
|
|
||||||
|
|
||||||
/* Continue until the end of line, or until a " followed by a
|
/* Continue until the end of line, or until a " followed by a
|
||||||
* blank character or the end of line. */
|
* blank character or the end of line. */
|
||||||
while (*ptr != '\0' && (*ptr != '"' ||
|
while (*ptr != '\0' && (*ptr != '"' ||
|
||||||
(*(ptr + 1) != '\0' && !isblank((unsigned char)ptr[1]))))
|
(*(ptr + 1) != '\0' && !isblank((unsigned char)ptr[1]))))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
assert(*ptr == '"' || *ptr == '\0');
|
|
||||||
|
|
||||||
if (*ptr == '\0') {
|
if (*ptr == '\0') {
|
||||||
rcfile_error(
|
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||||
N_("Regex strings must begin and end with a \" character"));
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,8 +265,6 @@ void parse_syntax(char *ptr)
|
||||||
|
|
||||||
opensyntax = FALSE;
|
opensyntax = FALSE;
|
||||||
|
|
||||||
assert(ptr != NULL);
|
|
||||||
|
|
||||||
/* Check that the syntax name is not empty. */
|
/* Check that the syntax name is not empty. */
|
||||||
if (*ptr == '\0' || (*ptr == '"' &&
|
if (*ptr == '\0' || (*ptr == '"' &&
|
||||||
(*(ptr + 1) == '\0' || *(ptr + 1) == '"'))) {
|
(*(ptr + 1) == '\0' || *(ptr + 1) == '"'))) {
|
||||||
|
@ -324,8 +317,7 @@ void parse_syntax(char *ptr)
|
||||||
|
|
||||||
/* The default syntax should have no associated extensions. */
|
/* The default syntax should have no associated extensions. */
|
||||||
if (strcmp(live_syntax->name, "default") == 0 && *ptr != '\0') {
|
if (strcmp(live_syntax->name, "default") == 0 && *ptr != '\0') {
|
||||||
rcfile_error(
|
rcfile_error(N_("The \"default\" syntax does not accept extensions"));
|
||||||
N_("The \"default\" syntax does not accept extensions"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,8 +352,6 @@ void parse_binding(char *ptr, bool dobind)
|
||||||
sc *s, *newsc = NULL;
|
sc *s, *newsc = NULL;
|
||||||
int menu;
|
int menu;
|
||||||
|
|
||||||
assert(ptr != NULL);
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Starting the rebinding code...\n");
|
fprintf(stderr, "Starting the rebinding code...\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -620,9 +610,8 @@ void parse_colors(char *ptr, int rex_flags)
|
||||||
char *item;
|
char *item;
|
||||||
|
|
||||||
if (!opensyntax) {
|
if (!opensyntax) {
|
||||||
rcfile_error(
|
rcfile_error(N_("A '%s' command requires a preceding 'syntax' command"),
|
||||||
N_("A '%s' command requires a preceding 'syntax' command"),
|
"color");
|
||||||
"color");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,8 +646,7 @@ void parse_colors(char *ptr, int rex_flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*ptr != '"') {
|
if (*ptr != '"') {
|
||||||
rcfile_error(
|
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||||
N_("Regex strings must begin and end with a \" character"));
|
|
||||||
ptr = parse_next_regex(ptr);
|
ptr = parse_next_regex(ptr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -817,8 +805,7 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
|
||||||
regexlisttype *newthing;
|
regexlisttype *newthing;
|
||||||
|
|
||||||
if (*ptr != '"') {
|
if (*ptr != '"') {
|
||||||
rcfile_error(
|
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||||
N_("Regex strings must begin and end with a \" character"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -848,8 +835,6 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
|
||||||
/* Gather and store the string after a comment/linter/formatter command. */
|
/* Gather and store the string after a comment/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)
|
||||||
{
|
{
|
||||||
assert(ptr != NULL);
|
|
||||||
|
|
||||||
if (!opensyntax) {
|
if (!opensyntax) {
|
||||||
rcfile_error(
|
rcfile_error(
|
||||||
N_("A '%s' command requires a preceding 'syntax' command"), kind);
|
N_("A '%s' command requires a preceding 'syntax' command"), kind);
|
||||||
|
|
Loading…
Reference in New Issue