tweaks: reshuffle some stuff, and avoid a memory leak
parent
4b24ce1c11
commit
2ff398c685
23
src/rcfile.c
23
src/rcfile.c
|
@ -774,22 +774,21 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse interface color options. */
|
/* Parse the argument of an interface color option. */
|
||||||
colortype *parse_interface_color(char *combostr)
|
colortype *parse_interface_color(char *combostr)
|
||||||
{
|
{
|
||||||
short fg, bg;
|
colortype *trio = nmalloc(sizeof(colortype));
|
||||||
bool bright = FALSE;
|
|
||||||
colortype *newcolor;
|
|
||||||
|
|
||||||
if (!parse_color_names(combostr, &fg, &bg, &bright))
|
trio->bright = FALSE;
|
||||||
|
|
||||||
|
if (parse_color_names(combostr, &trio->fg, &trio->bg, &trio->bright)) {
|
||||||
|
free(combostr);
|
||||||
|
return trio;
|
||||||
|
} else {
|
||||||
|
free(combostr);
|
||||||
|
free(trio);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
newcolor = (colortype *)nmalloc(sizeof(colortype));
|
|
||||||
newcolor->fg = fg;
|
|
||||||
newcolor->bg = bg;
|
|
||||||
newcolor->bright = bright;
|
|
||||||
|
|
||||||
return newcolor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read regex strings enclosed in double quotes from the line pointed at
|
/* Read regex strings enclosed in double quotes from the line pointed at
|
||||||
|
|
Loading…
Reference in New Issue