Browse Source

inpcom.c, simplify error processing

pre-master-46
rlar 13 years ago
parent
commit
cde7286721
  1. 16
      src/frontend/inpcom.c

16
src/frontend/inpcom.c

@ -4190,13 +4190,12 @@ inp_compat(struct line *card)
title_tok, node1, node2, title_tok);
// get the expression
str_ptr = gettok(&cut_line); /* ignore 'table' */
if (cieq(str_ptr, "table")) {
tfree(str_ptr);
} else {
if (!cieq(str_ptr, "table")) {
fprintf(stderr, "Error: bad sytax in line %d\n %s\n",
card->li_linenum_orig, card->li_line);
controlled_exit(EXIT_BAD);
}
tfree(str_ptr);
str_ptr = gettok_char(&cut_line, '{', FALSE, FALSE);
expression = gettok_char(&cut_line, '}', TRUE, TRUE); /* expression */
if ((!expression) || (!str_ptr)) {
@ -4204,8 +4203,7 @@ inp_compat(struct line *card)
card->li_linenum_orig, card->li_line);
controlled_exit(EXIT_BAD);
}
else
tfree(str_ptr);
tfree(str_ptr);
/* remove '{' and '}' from expression */
if ((str_ptr = strchr(expression, '{')) != NULL)
*str_ptr = ' ';
@ -4383,13 +4381,12 @@ inp_compat(struct line *card)
title_tok, node1, node2, title_tok);
// get the expression
str_ptr = gettok(&cut_line); /* ignore 'table' */
if (cieq(str_ptr, "table")) {
tfree(str_ptr);
} else {
if (!cieq(str_ptr, "table")) {
fprintf(stderr, "Error: bad sytax in line %d\n %s\n",
card->li_linenum_orig, card->li_line);
controlled_exit(EXIT_BAD);
}
tfree(str_ptr);
str_ptr = gettok_char(&cut_line, '{', FALSE, FALSE);
expression = gettok_char(&cut_line, '}', TRUE, TRUE); /* expression */
if ((!expression) || (!str_ptr)) {
@ -4397,8 +4394,7 @@ inp_compat(struct line *card)
card->li_linenum_orig, card->li_line);
controlled_exit(EXIT_BAD);
}
else
tfree(str_ptr);
tfree(str_ptr);
/* remove '{' and '}' from expression */
if ((str_ptr = strchr(expression, '{')) != NULL)
*str_ptr = ' ';

Loading…
Cancel
Save