Outliner: Ensure compiler error when passing wrong tree-element to macro

Passing a `TreeElement *` instead of its `TreeStoreElement *` to
`TSELEM_OPEN()` would seem to work but cause a bug. Add a type check
that will cause a compiler error if it fails.
This commit is contained in:
Julian Eisel 2022-03-09 15:28:16 +01:00
parent 8e3a58578a
commit 39c50d8f31
1 changed files with 3 additions and 2 deletions

View File

@ -219,8 +219,9 @@ typedef enum {
/* is the current element open? if so we also show children */
#define TSELEM_OPEN(telm, sv) \
(((telm)->flag & TSE_CLOSED) == 0 || \
(SEARCHING_OUTLINER(sv) && ((telm)->flag & TSE_CHILDSEARCH)))
(CHECK_TYPE_INLINE(telm, TreeStoreElem *), \
(((telm)->flag & TSE_CLOSED) == 0 || \
(SEARCHING_OUTLINER(sv) && ((telm)->flag & TSE_CHILDSEARCH))))
/**
* Container to avoid passing around these variables to many functions.