aboutsummaryrefslogtreecommitdiffstats
path: root/src/jack.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-09-29 19:27:35 -0400
committerDavid Robillard <d@drobilla.net>2024-10-12 14:07:10 -0400
commitdd4fb898df782cb5825eb25d64d0198226b5e7b0 (patch)
tree7eef44285825142cdddf53361a09cecef1a4847e /src/jack.c
parentae5087095b0adb5020708025837108656039903f (diff)
downloadjalv-dd4fb898df782cb5825eb25d64d0198226b5e7b0.tar.gz
jalv-dd4fb898df782cb5825eb25d64d0198226b5e7b0.tar.bz2
jalv-dd4fb898df782cb5825eb25d64d0198226b5e7b0.zip
Return distinct error codes from jack_initialize()
Diffstat (limited to 'src/jack.c')
-rw-r--r--src/jack.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/jack.c b/src/jack.c
index 59f10d1..52b78a1 100644
--- a/src/jack.c
+++ b/src/jack.c
@@ -475,20 +475,27 @@ jalv_backend_activate_port(Jalv* jalv, uint32_t port_index)
int
jack_initialize(jack_client_t* const client, const char* const load_init)
{
+#ifndef E2BIG
+# define E2BIG 7
+#endif
+#ifndef ENOMEM
+# define ENOMEM 12
+#endif
+
const size_t args_len = strlen(load_init);
if (args_len > JACK_LOAD_INIT_LIMIT) {
jalv_log(JALV_LOG_ERR, "Too many arguments given\n");
- return -1;
+ return E2BIG;
}
Jalv* const jalv = (Jalv*)calloc(1, sizeof(Jalv));
if (!jalv) {
- return -1;
+ return ENOMEM;
}
if (!(jalv->backend = (JalvBackend*)calloc(1, sizeof(JalvBackend)))) {
free(jalv);
- return -1;
+ return ENOMEM;
}
jalv->backend->client = client;
@@ -522,6 +529,9 @@ jack_initialize(jack_client_t* const client, const char* const load_init)
free(argv);
free(cmd);
return err;
+
+#undef ENOMEM
+#undef E2BIG
}
void