diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-07-04 14:19:01 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-01 17:53:32 +0100 |
| commit | c376727487f988de9b5368e67e9bdcb2b59edde4 (patch) | |
| tree | 33812a95d29f1fc4ec20fde56b19c73beda31bde | |
| parent | 58346b848ce3febccbfb2e2db7ad4262f0630a97 (diff) | |
| download | sparse-dev-c376727487f988de9b5368e67e9bdcb2b59edde4.tar.gz | |
add helper: valid_type()
'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@gmail.com>
| -rw-r--r-- | symbol.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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); |
