mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
spa: support: log: convert spa_log_level_topic_enabled() to a function
There is no reason for it to be a macro.
This commit is contained in:
parent
0366a52f3a
commit
ebf93f1417
1 changed files with 15 additions and 9 deletions
|
|
@ -205,15 +205,21 @@ static inline void spa_log_topic_init(struct spa_log *log, struct spa_log_topic
|
||||||
/* Unused, left for backwards compat */
|
/* Unused, left for backwards compat */
|
||||||
#define spa_log_level_enabled(l,lev) ((l) && (l)->level >= (lev))
|
#define spa_log_level_enabled(l,lev) ((l) && (l)->level >= (lev))
|
||||||
|
|
||||||
#define spa_log_level_topic_enabled(l,topic,lev) \
|
static inline bool spa_log_level_topic_enabled(const struct spa_log *log,
|
||||||
({ \
|
const struct spa_log_topic *topic,
|
||||||
struct spa_log *_log = l; \
|
enum spa_log_level level)
|
||||||
enum spa_log_level _lev = _log ? _log->level : SPA_LOG_LEVEL_NONE; \
|
{
|
||||||
struct spa_log_topic *_t = (struct spa_log_topic *)(topic); \
|
enum spa_log_level max_level;
|
||||||
if (_t && _t->has_custom_level) \
|
|
||||||
_lev = _t->level; \
|
if (topic && topic->has_custom_level)
|
||||||
_lev >= (lev); \
|
max_level = topic->level;
|
||||||
})
|
else if (log)
|
||||||
|
max_level = log->level;
|
||||||
|
else
|
||||||
|
max_level = SPA_LOG_LEVEL_NONE;
|
||||||
|
|
||||||
|
return level <= max_level;
|
||||||
|
}
|
||||||
|
|
||||||
/* Transparently calls to version 0 log if v1 is not supported */
|
/* Transparently calls to version 0 log if v1 is not supported */
|
||||||
#define spa_log_logt(l,lev,topic,...) \
|
#define spa_log_logt(l,lev,topic,...) \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue