don't use error()

This commit is contained in:
Wim Taymans 2019-06-21 16:14:36 +02:00
parent 6720ded529
commit 9934e62fe4
3 changed files with 17 additions and 16 deletions

View file

@ -23,7 +23,6 @@
*/
#include <math.h>
#include <error.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@ -322,8 +321,10 @@ static int make_nodes(struct data *data, const char *device)
if ((res = spa_node_port_set_io(data->source,
SPA_DIRECTION_OUTPUT, 0,
SPA_IO_Control,
&data->ctrl, sizeof(data->ctrl))) < 0)
error(0, -res, "set_io freq");
&data->ctrl, sizeof(data->ctrl))) < 0) {
printf("can't set_io freq: %d\n", res);
return res;
}
data->source_sink_io[0] = SPA_IO_BUFFERS_INIT;

View file

@ -26,7 +26,8 @@ static int spa_alsa_open(struct state *state)
CHECK(snd_output_stdio_attach(&state->output, stderr, 0), "attach failed");
spa_log_info(state->log, "%p: ALSA device open '%s'", state, props->device);
spa_log_info(state->log, "%p: ALSA device open '%s' %s", state, props->device,
state->stream == SND_PCM_STREAM_CAPTURE ? "capture" : "playback");
CHECK(snd_pcm_open(&state->hndl,
props->device,
state->stream,

View file

@ -22,7 +22,6 @@
* DEALINGS IN THE SOFTWARE.
*/
#include <error.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@ -94,7 +93,7 @@ inspect_node_params(struct data *data, struct spa_node *node,
spa_hook_remove(&listener);
if (res != 0) {
error(0, -res, "enum_params %d", params[i].id);
printf("error enum_params %d: %s", params[i].id, spa_strerror(res));
break;
}
}
@ -132,7 +131,7 @@ inspect_port_params(struct data *data, struct spa_node *node,
spa_hook_remove(&listener);
if (res != 0) {
error(0, -res, "port_enum_params %d", params[i].id);
printf("error port_enum_params %d: %s", params[i].id, spa_strerror(res));
break;
}
}
@ -212,10 +211,10 @@ static void inspect_factory(struct data *data, const struct spa_handle_factory *
printf("factory interfaces:\n");
for (index = 0;;) {
if ((res = spa_handle_factory_enum_interface_info(factory, &info, &index)) <= 0) {
if (res == 0)
break;
else
error(0, -res, "spa_handle_factory_enum_interface_info");
if (res != 0)
printf("error spa_handle_factory_enum_interface_info: %s",
spa_strerror(res));
break;
}
printf(" interface: '%d'\n", info->type);
}
@ -231,10 +230,10 @@ static void inspect_factory(struct data *data, const struct spa_handle_factory *
for (index = 0;;) {
if ((res = spa_handle_factory_enum_interface_info(factory, &info, &index)) <= 0) {
if (res == 0)
break;
else
error(0, -res, "spa_handle_factory_enum_interface_info");
if (res != 0)
printf("error spa_handle_factory_enum_interface_info: %s",
spa_strerror(res));
break;
}
printf(" interface: '%d'\n", info->type);
@ -296,7 +295,7 @@ int main(int argc, char *argv[])
if ((res = enum_func(&factory, &index)) <= 0) {
if (res != 0)
error(0, -res, "enum_func");
printf("error enum_func: %s", spa_strerror(res));
break;
}
inspect_factory(&data, factory);