'bad_type' is used for ... bad types instead of NULL in order to avoid later lots of null-checking. Alas NULL is also often used and so we have to check for NULL and 'bad_ctype' when checking a type's validity. Add an helper: valid_type() to make the code a bit simpler. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- symbol.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/symbol.h b/symbol.h index fd5746429..b4d1c2acc 100644 --- a/symbol.h +++ b/symbol.h @@ -309,6 +309,11 @@ extern void debug_symbol(struct symbol *); extern void merge_type(struct symbol *sym, struct symbol *base_type); extern void check_declaration(struct symbol *sym); +static inline int valid_type(const struct symbol *ctype) +{ + return ctype && ctype != &bad_ctype; +} + static inline struct symbol *get_base_type(const struct symbol *sym) { return examine_symbol_type(sym->ctype.base_type); -- 2.16.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html