From: Christoph Mallon Date: Sat, 4 Jun 2011 12:43:29 +0000 (+0200) Subject: Reduce code duplication. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=82daa86313ed2fc1c703f99d1f499de2494d6bf2;p=cparser Reduce code duplication. --- diff --git a/parser.c b/parser.c index 65bf933..c4883b5 100644 --- a/parser.c +++ b/parser.c @@ -2446,13 +2446,10 @@ static compound_t *parse_compound_type_specifier(bool is_struct) } } } else if (token.type != '{') { - if (is_struct) { - parse_error_expected("while parsing struct type specifier", - T_IDENTIFIER, '{', NULL); - } else { - parse_error_expected("while parsing union type specifier", - T_IDENTIFIER, '{', NULL); - } + char const *const msg = + is_struct ? "while parsing struct type specifier" : + "while parsing union type specifier"; + parse_error_expected(msg, T_IDENTIFIER, '{', NULL); return NULL; }