1
Fork 0

pipewire: log: fix concatenation in log topic macros

`__LINE__` was not expanded previously. Fix that.
This commit is contained in:
Barnabás Pőcze 2023-12-23 18:40:43 +01:00 committed by Wim Taymans
parent da7cf84f95
commit c130ec9de9
1 changed files with 5 additions and 4 deletions

View File

@ -6,6 +6,7 @@
#define PIPEWIRE_LOG_H
#include <spa/support/log.h>
#include <spa/utils/defs.h>
#ifdef __cplusplus
extern "C" {
@ -84,8 +85,8 @@ pw_log_logv(enum spa_log_level level,
* \endcode
*/
#define PW_LOG_TOPIC_STATIC(var, topic) \
static struct spa_log_topic var##__LINE__ = SPA_LOG_TOPIC(0, topic); \
static struct spa_log_topic *var = &(var##__LINE__)
static struct spa_log_topic SPA_CONCAT(var, __LINE__) = SPA_LOG_TOPIC(0, topic); \
static struct spa_log_topic *var = &SPA_CONCAT(var, __LINE__)
/**
* Declare a static log topic named \a var.
@ -99,8 +100,8 @@ pw_log_logv(enum spa_log_level level,
* See \ref PW_LOG_TOPIC_STATIC for an example usage.
*/
#define PW_LOG_TOPIC(var, topic) \
struct spa_log_topic var##__LINE__ = SPA_LOG_TOPIC(0, topic); \
struct spa_log_topic *var = &(var##__LINE__)
struct spa_log_topic SPA_CONCAT(var, __LINE__) = SPA_LOG_TOPIC(0, topic); \
struct spa_log_topic *var = &SPA_CONCAT(var, __LINE__)
#define PW_LOG_TOPIC_INIT(var) \
spa_log_topic_init(pw_log_get(), var);