utils: add some more helpers

This commit is contained in:
Wim Taymans 2018-06-01 11:08:25 +02:00
parent b6500bcb80
commit 6f5a2701f3
2 changed files with 7 additions and 0 deletions

View file

@ -172,6 +172,12 @@ struct spa_fraction {
} \
} while (false)
#define spa_assert_not_reached() \
do { \
fprintf(stderr, "Code should not be reached at %s:%u %s()", \
__FILE__, __LINE__, __func__); \
abort(); \
} while (false)
/* Does exactly nothing */
#define spa_nop() do {} while (false)

View file

@ -44,6 +44,7 @@ struct spa_dict {
};
#define SPA_DICT_INIT(items,n_items) (struct spa_dict) { items, n_items }
#define SPA_DICT_INIT_ARRAY(items) (struct spa_dict) { items, SPA_N_ELEMENTS(items) }
#define spa_dict_for_each(item, dict) \
for ((item) = (dict)->items; \