1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-07-01 02:08:54 +03:00

b2/subst.c (prepare_re): fail on bad (#unit) syntax instead of ignoring

This commit is contained in:
Werner Almesberger 2012-05-22 12:07:41 -03:00
parent d2171eba47
commit 2946b830f1

View File

@ -86,8 +86,9 @@ static char *prepare_re(const char *re, int *parens, char *units)
break;
case '(':
(*parens)++;
if (re[1] == '#' && re[2] && isalpha(re[2]) &&
re[3] == ')') {
if (re[1] == '#' && re[2]) {
if (!isalpha(re[2]) || re[3] != ')')
yyerrorf("invalid (#unit) syntax");
units[*parens-1] = re[2];
unit_expr(&res, &res_len, re[2]);
re += 3;