diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-08-31 11:43:50 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-08-31 11:43:50 -0700 |
commit | dc6b630ed191cc32399304717f77958c8e18c6ad (patch) | |
tree | 8308115069b9e7c838b01adb65ec59cff5c100a9 | |
parent | c5e0f1db92673e7520e42563dff894b211187b28 (diff) |
modules/*: use til_setup_free_with_ret_err() where apropos
Just some more res_setup baking failure path cleanups, largely
mechanical change.
-rw-r--r-- | src/modules/checkers/checkers.c | 6 | ||||
-rw-r--r-- | src/modules/compose/compose.c | 12 | ||||
-rw-r--r-- | src/modules/mixer/mixer.c | 7 | ||||
-rw-r--r-- | src/modules/montage/montage.c | 6 | ||||
-rw-r--r-- | src/modules/rkt/rkt.c | 28 | ||||
-rw-r--r-- | src/modules/roto/roto.c | 6 | ||||
-rw-r--r-- | src/modules/rtv/rtv.c | 21 |
7 files changed, 26 insertions, 60 deletions
diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c index 149a8bd..360d553 100644 --- a/src/modules/checkers/checkers.c +++ b/src/modules/checkers/checkers.c @@ -866,10 +866,8 @@ static int checkers_setup(const til_settings_t *settings, til_setting_t **res_se res_setting, res_desc, &setup->fill_module_setup); /* finalize! */ - if (r < 0) { - til_setup_free(&setup->til_setup); - return r; - } + if (r < 0) + return til_setup_free_with_ret_err(&setup->til_setup, r); assert(r == 0); diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c index d4835cc..2740939 100644 --- a/src/modules/compose/compose.c +++ b/src/modules/compose/compose.c @@ -381,10 +381,8 @@ static int compose_setup(const til_settings_t *settings, til_setting_t **res_set res_setting, res_desc, &setup->layers[i].module_setup); /* finalize! */ - if (r < 0) { - til_setup_free(&setup->til_setup); - return r; - } + if (r < 0) + return til_setup_free_with_ret_err(&setup->til_setup, r); assert(r == 0); } @@ -393,10 +391,8 @@ static int compose_setup(const til_settings_t *settings, til_setting_t **res_set res_setting, res_desc, &setup->texture.module_setup); /* finalize! */ - if (r < 0) { - til_setup_free(&setup->til_setup); - return r; - } + if (r < 0) + return til_setup_free_with_ret_err(&setup->til_setup, r); assert(r == 0); diff --git a/src/modules/mixer/mixer.c b/src/modules/mixer/mixer.c index ba278fe..5ec54ed 100644 --- a/src/modules/mixer/mixer.c +++ b/src/modules/mixer/mixer.c @@ -429,11 +429,8 @@ static int mixer_setup(const til_settings_t *settings, til_setting_t **res_setti input_preferred[i], (TIL_MODULE_EXPERIMENTAL | TIL_MODULE_HERMETIC), exclusions); - if (r < 0) { - til_setup_free(&setup->til_setup); - /* til_module_setup_full() should already have populated *res_setting */ - return r; - } + if (r < 0) + return til_setup_free_with_ret_err(&setup->til_setup, r); assert(r == 0); } diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c index 7bec28a..8ee8df7 100644 --- a/src/modules/montage/montage.c +++ b/src/modules/montage/montage.c @@ -304,10 +304,8 @@ static int montage_setup(const til_settings_t *settings, til_setting_t **res_set res_setting, res_desc, &setup->tiles[i].setup); /* finalize! */ - if (r < 0) { - til_setup_free(&setup->til_setup); - return r; - } + if (r < 0) + return til_setup_free_with_ret_err(&setup->til_setup, r); assert(r == 0); } diff --git a/src/modules/rkt/rkt.c b/src/modules/rkt/rkt.c index 0e162e6..677e2b9 100644 --- a/src/modules/rkt/rkt.c +++ b/src/modules/rkt/rkt.c @@ -633,11 +633,8 @@ static int rkt_setup(const til_settings_t *settings, til_setting_t **res_setting setup->scener_listen = 1; setup->scener_address = strdup(listen_address->value); - if (!setup->scener_address) { - til_setup_free(&setup->til_setup); - - return -ENOMEM; - } + if (!setup->scener_address) + return til_setup_free_with_ret_err(&setup->til_setup, -ENOMEM); if (sscanf(listen_port->value, "%hu", &setup->scener_port) != 1) return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, listen_port, res_setting, -EINVAL); @@ -669,31 +666,22 @@ static int rkt_setup(const til_settings_t *settings, til_setting_t **res_setting res_setting, res_desc, &setup->scenes[i].setup); /* XXX: note no res_setup, must defer finalize */ - if (r < 0) { - til_setup_free(&setup->til_setup); - - return r; - } + if (r < 0) + return til_setup_free_with_ret_err(&setup->til_setup, r); assert(r == 0); /* the settings should be complete by now, so this is unexpected */ } setup->base = strdup(base->value); - if (!setup->base) { - til_setup_free(&setup->til_setup); - - return -ENOMEM; - } + if (!setup->base) + return til_setup_free_with_ret_err(&setup->til_setup, -ENOMEM); if (!strcasecmp(connect->value, "on")) { setup->connect = 1; setup->host = strdup(host->value); - if (!setup->host) { - til_setup_free(&setup->til_setup); - - return -ENOMEM; - } + if (!setup->host) + return til_setup_free_with_ret_err(&setup->til_setup, -ENOMEM); if (sscanf(port->value, "%hu", &setup->port) != 1) return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, port, res_setting, -EINVAL); diff --git a/src/modules/roto/roto.c b/src/modules/roto/roto.c index a0fb680..8d71cba 100644 --- a/src/modules/roto/roto.c +++ b/src/modules/roto/roto.c @@ -502,10 +502,8 @@ static int roto_setup(const til_settings_t *settings, til_setting_t **res_settin res_setting, res_desc, &setup->fill_module_setup); /* finalize! */ - if (r < 0) { - til_setup_free(&setup->til_setup); - return r; - } + if (r < 0) + return til_setup_free_with_ret_err(&setup->til_setup, r); assert(r == 0); diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index 17fa57a..95418aa 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -521,11 +521,8 @@ static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting til_get_modules(&modules, &n_modules); tokchannels = strdup(channels->value); /* TODO FIXME: this is getting leaked currently */ - if (!tokchannels) { - til_setup_free(&setup->til_setup); - - return -ENOMEM; - } + if (!tokchannels) + return til_setup_free_with_ret_err(&setup->til_setup, -ENOMEM); channel = strtok(tokchannels, ":"); do { @@ -541,11 +538,8 @@ static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, channels, res_setting, -EINVAL); new = realloc(setup, sizeof(*setup) + n * sizeof(setup->channels[0])); - if (!new) { - til_setup_free(&setup->til_setup); - - return -ENOMEM; - } + if (!new) + return til_setup_free_with_ret_err(&setup->til_setup, -ENOMEM); new->channels[n - 2] = channel; new->channels[n - 1] = NULL; @@ -560,11 +554,8 @@ static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting res_setting, res_desc, &setup->snow_module_setup); /* finalize! */ - if (r < 0) { - til_setup_free(&setup->til_setup); - - return r; - } + if (r < 0) + return til_setup_free_with_ret_err(&setup->til_setup, r); assert(r == 0); |