tweaks: chuck two useless asserts, and elide a call to strncasecmp()
parent
9462ba8217
commit
f46544f67b
13
src/rcfile.c
13
src/rcfile.c
|
@ -613,8 +613,6 @@ void parse_includes(char *ptr)
|
||||||
* and set bright to TRUE if that color is bright. */
|
* and set bright to TRUE if that color is bright. */
|
||||||
short color_to_short(const char *colorname, bool *bright)
|
short color_to_short(const char *colorname, bool *bright)
|
||||||
{
|
{
|
||||||
assert(colorname != NULL && bright != NULL);
|
|
||||||
|
|
||||||
if (strncasecmp(colorname, "bright", 6) == 0) {
|
if (strncasecmp(colorname, "bright", 6) == 0) {
|
||||||
*bright = TRUE;
|
*bright = TRUE;
|
||||||
colorname += 6;
|
colorname += 6;
|
||||||
|
@ -654,8 +652,6 @@ void parse_colors(char *ptr, int rex_flags)
|
||||||
bool bright = FALSE;
|
bool bright = FALSE;
|
||||||
char *item;
|
char *item;
|
||||||
|
|
||||||
assert(ptr != NULL);
|
|
||||||
|
|
||||||
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"),
|
||||||
|
@ -729,9 +725,6 @@ void parse_colors(char *ptr, int rex_flags)
|
||||||
|
|
||||||
newcolor->next = NULL;
|
newcolor->next = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr, "Adding an entry for fg %hd, bg %hd\n", fg, bg);
|
|
||||||
#endif
|
|
||||||
if (lastcolor == NULL)
|
if (lastcolor == NULL)
|
||||||
live_syntax->color = newcolor;
|
live_syntax->color = newcolor;
|
||||||
else
|
else
|
||||||
|
@ -785,12 +778,12 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
|
||||||
char *comma = strchr(combostr, ',');
|
char *comma = strchr(combostr, ',');
|
||||||
|
|
||||||
if (comma != NULL) {
|
if (comma != NULL) {
|
||||||
*comma = '\0';
|
*bg = color_to_short(comma + 1, bright);
|
||||||
if (strncasecmp(comma + 1, "bright", 6) == 0) {
|
if (*bright) {
|
||||||
rcfile_error(N_("A background color cannot be bright"));
|
rcfile_error(N_("A background color cannot be bright"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
*bg = color_to_short(comma + 1, bright);
|
*comma = '\0';
|
||||||
} else
|
} else
|
||||||
*bg = -1;
|
*bg = -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue