mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-15 07:00:05 -05:00
spa: add spa_aprintf helper
Add a asprintf helper function that handles errors correctly. Use this in places where we use asprintf to avoid warnings when we don't check the return value.
This commit is contained in:
parent
aee3191bad
commit
6ac9b7b3a7
16 changed files with 102 additions and 85 deletions
|
|
@ -241,6 +241,14 @@ struct spa_fraction {
|
|||
#define spa_memmove(d,s,n) memmove(d,s,n)
|
||||
#endif
|
||||
|
||||
#define spa_aprintf(_fmt, ...) \
|
||||
({ \
|
||||
char *_strp; \
|
||||
if (asprintf(&(_strp), (_fmt), ## __VA_ARGS__ ) == -1) \
|
||||
_strp = NULL; \
|
||||
_strp; \
|
||||
})
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue