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:
Wim Taymans 2020-01-27 12:19:21 +01:00
parent aee3191bad
commit 6ac9b7b3a7
16 changed files with 102 additions and 85 deletions

View file

@ -796,11 +796,14 @@ static int snd_pcm_pipewire_open(snd_pcm_t **pcmp, const char *name,
pw->flags = flags;
if (node_name == NULL)
err = asprintf(&pw->node_name, "ALSA %s",
pw->node_name = spa_aprintf("ALSA %s",
stream == SND_PCM_STREAM_PLAYBACK ? "Playback" : "Capture");
else
pw->node_name = strdup(node_name);
if (pw->node_name == NULL)
return -errno;
pw->target = PW_ID_ANY;
if (str != NULL)
pw->target = atoi(str);