Simplify always evaluated branch (e != NULL)

- xalloc(..) ensures that e will be non-null via malloc + err.
- `e` is already dereferenced above, so logically it's impossible
  to hit the lower test without crashing if it was indeed NULL.

MFC after: 3 days
CID: 1007408
Reported by: Coverity
Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
Enji Cooper 2016-04-22 05:24:15 +00:00
parent d1c801bbf1
commit 1422b66c64

View File

@ -743,10 +743,8 @@ parse_type(enum tok *tok, struct type *t, const char *vname)
report("need value for ENUM/BITS");
if (gettoken() != TOK_STR)
report("need string in ENUM/BITS");
if (e != NULL) {
e->name = savetok();
TAILQ_INSERT_TAIL(&t->enums, e, link);
}
e->name = savetok();
TAILQ_INSERT_TAIL(&t->enums, e, link);
if ((*tok = gettoken()) == TOK_EOF)
report("unexpected EOF in ENUM/BITS");
} while (*tok != ')');