Fix some badly-behaved macros

Some macros evaluated their arguments more than once when it was not
needed, or were missing parentheses.
This commit is contained in:
Demi Marie Obenour 2022-09-01 17:02:44 -04:00
parent bb4f274ae0
commit 671a7102ff
46 changed files with 162 additions and 156 deletions

View file

@ -68,7 +68,7 @@ struct spa_audio_info_dsd {
uint32_t position[SPA_AUDIO_MAX_CHANNELS]; /*< channel position from enum spa_audio_channel */
};
#define SPA_AUDIO_INFO_DSD_INIT(...) (struct spa_audio_info_dsd) { __VA_ARGS__ }
#define SPA_AUDIO_INFO_DSD_INIT(...) ((struct spa_audio_info_dsd) { __VA_ARGS__ })
/**
* \}

View file

@ -56,7 +56,7 @@ struct spa_audio_info_iec958 {
uint32_t rate; /*< sample rate */
};
#define SPA_AUDIO_INFO_IEC958_INIT(...) (struct spa_audio_info_iec958) { __VA_ARGS__ }
#define SPA_AUDIO_INFO_IEC958_INIT(...) ((struct spa_audio_info_iec958) { __VA_ARGS__ })
/**
* \}

View file

@ -294,7 +294,7 @@ struct spa_audio_info_raw {
uint32_t position[SPA_AUDIO_MAX_CHANNELS]; /*< channel position from enum spa_audio_channel */
};
#define SPA_AUDIO_INFO_RAW_INIT(...) (struct spa_audio_info_raw) { __VA_ARGS__ }
#define SPA_AUDIO_INFO_RAW_INIT(...) ((struct spa_audio_info_raw) { __VA_ARGS__ })
#define SPA_KEY_AUDIO_FORMAT "audio.format" /**< an audio format as string,
* Ex. "S16LE" */
@ -311,7 +311,7 @@ struct spa_audio_info_dsp {
enum spa_audio_format format; /*< format, one of the DSP formats in enum spa_audio_format_dsp */
};
#define SPA_AUDIO_INFO_DSP_INIT(...) (struct spa_audio_info_dsp) { __VA_ARGS__ }
#define SPA_AUDIO_INFO_DSP_INIT(...) ((struct spa_audio_info_dsp) { __VA_ARGS__ })
/**
* \}

View file

@ -50,7 +50,7 @@ struct spa_latency_info {
uint64_t max_ns;
};
#define SPA_LATENCY_INFO(dir,...) (struct spa_latency_info) { .direction = (dir), ## __VA_ARGS__ }
#define SPA_LATENCY_INFO(dir,...) ((struct spa_latency_info) { .direction = (dir), ## __VA_ARGS__ })
static inline int
spa_latency_info_compare(const struct spa_latency_info *a, struct spa_latency_info *b)
@ -146,7 +146,7 @@ struct spa_process_latency_info {
uint64_t ns;
};
#define SPA_PROCESS_LATENCY_INFO_INIT(...) (struct spa_process_latency_info) { __VA_ARGS__ }
#define SPA_PROCESS_LATENCY_INFO_INIT(...) ((struct spa_process_latency_info) { __VA_ARGS__ })
static inline int
spa_process_latency_parse(const struct spa_pod *latency, struct spa_process_latency_info *info)

View file

@ -75,7 +75,7 @@ struct spa_param_info {
uint32_t padding[5];
};
#define SPA_PARAM_INFO(id,flags) (struct spa_param_info){ (id), (flags) }
#define SPA_PARAM_INFO(id,flags) ((struct spa_param_info){ (id), (flags) })
/** properties for SPA_TYPE_OBJECT_ParamBuffers */
enum spa_param_buffers {

View file

@ -206,14 +206,14 @@ struct spa_video_info_raw {
enum spa_video_color_primaries color_primaries; /**< color primaries. used to convert between R'G'B' and CIE XYZ */
};
#define SPA_VIDEO_INFO_RAW_INIT(...) (struct spa_video_info_raw) { __VA_ARGS__ }
#define SPA_VIDEO_INFO_RAW_INIT(...) ((struct spa_video_info_raw) { __VA_ARGS__ })
struct spa_video_info_dsp {
enum spa_video_format format;
int64_t modifier;
};
#define SPA_VIDEO_INFO_DSP_INIT(...) (struct spa_video_info_dsp) { __VA_ARGS__ }
#define SPA_VIDEO_INFO_DSP_INIT(...) ((struct spa_video_info_dsp) { __VA_ARGS__ })
/**
* \}