cfgparse: Don’t use asprintf when parsing hex colors

This commit is contained in:
Michael Stapelberg
2011-10-21 23:09:57 +01:00
parent 3a99c914e0
commit 77961ad9c8
2 changed files with 4 additions and 9 deletions

View File

@ -590,7 +590,6 @@ void parse_file(const char *f) {
%token <string> WORD "<word>"
%token <string> STR "<string>"
%token <string> STR_NG "<string (non-greedy)>"
%token <string> HEX "<hex>"
%token <string> HEXCOLOR "#<hex>"
%token <string> OUTPUT "<RandR output>"
%token TOKBINDCODE
@ -1506,14 +1505,10 @@ color:
;
colorpixel:
'#' HEX
HEXCOLOR
{
char *hex;
if (asprintf(&hex, "#%s", $2) == -1)
die("asprintf()");
free($2);
$$ = get_colorpixel(hex);
free(hex);
$$ = get_colorpixel($1);
free($1);
}
;