From cde7286721b5ee480e6e6eaffb553988570e8e02 Mon Sep 17 00:00:00 2001 From: rlar Date: Wed, 29 May 2013 21:34:20 +0200 Subject: [PATCH] inpcom.c, simplify error processing --- src/frontend/inpcom.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 7773b245d..0fd2a82e0 100644 --- a/src/frontend/inpcom.c +++ b/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 = ' ';