avoid error(), it's not defined on musl

This commit is contained in:
Wim Taymans 2019-06-21 16:33:49 +02:00
parent 37e66c9e55
commit 0720e375a1
4 changed files with 51 additions and 36 deletions

View file

@ -17,7 +17,6 @@
* Boston, MA 02110-1301, USA.
*/
#include <error.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@ -73,7 +72,7 @@ inspect_node_params(struct data *data, struct spa_node *node)
data->type.param.idList, &idx1,
NULL, &param, &b)) <= 0) {
if (res != 0)
error(0, -res, "enum_params");
printf("error enum_params: %s", spa_strerror(res));
break;
}
@ -88,7 +87,7 @@ inspect_node_params(struct data *data, struct spa_node *node)
id, &idx2,
NULL, &param, &b)) <= 0) {
if (res != 0)
error(0, -res, "enum_params %d", id);
printf("error enum_params %d: %s", id, spa_strerror(res));
break;
}
spa_debug_pod(0, data->map, param);
@ -115,7 +114,7 @@ inspect_port_params(struct data *data, struct spa_node *node,
data->type.param.idList, &idx1,
NULL, &param, &b)) <= 0) {
if (res != 0)
error(0, -res, "port_enum_params");
printf("error port_enum_params: %s", spa_strerror(res));
break;
}
spa_pod_object_parse(param,
@ -130,7 +129,7 @@ inspect_port_params(struct data *data, struct spa_node *node,
id, &idx2,
NULL, &param, &b)) <= 0) {
if (res != 0)
error(0, -res, "port_enum_params");
printf("error port_enum_params %d: %s", id, spa_strerror(res));
break;
}
@ -200,10 +199,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: '%s'\n", info->type);
}
@ -221,10 +220,10 @@ static void inspect_factory(struct data *data, const struct spa_handle_factory *
uint32_t interface_id;
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: '%s'\n", info->type);
@ -314,7 +313,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);