mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-08 13:30:08 -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
|
|
@ -64,7 +64,7 @@ out:
|
|||
return 0;
|
||||
|
||||
error_parse:
|
||||
asprintf(err, "%s:%u: %s", filename, lineno, local_err);
|
||||
*err = spa_aprintf("%s:%u: %s", filename, lineno, local_err);
|
||||
free(local_err);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ int pw_daemon_config_load_file(struct pw_daemon_config *config, const char *file
|
|||
pw_log_debug("deamon-config %p: loading configuration file '%s'", config, filename);
|
||||
|
||||
if ((f = fopen(filename, "r")) == NULL) {
|
||||
asprintf(err, "failed to open configuration file '%s': %s", filename,
|
||||
*err = spa_aprintf("failed to open configuration file '%s': %s", filename,
|
||||
strerror(errno));
|
||||
goto open_error;
|
||||
}
|
||||
|
|
@ -137,8 +137,7 @@ int pw_daemon_config_load_file(struct pw_daemon_config *config, const char *file
|
|||
if (!fgets(buf, sizeof(buf), f)) {
|
||||
if (feof(f))
|
||||
break;
|
||||
|
||||
asprintf(err, "failed to read configuration file '%s': %s",
|
||||
*err = spa_aprintf("failed to read configuration file '%s': %s",
|
||||
filename, strerror(errno));
|
||||
goto read_error;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue