summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/til_setup.c11
-rw-r--r--src/til_setup.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/til_setup.c b/src/til_setup.c
index c06614f..d5231a1 100644
--- a/src/til_setup.c
+++ b/src/til_setup.c
@@ -124,3 +124,14 @@ int til_setup_free_with_failed_setting_ret_err(til_setup_t *setup, til_setting_t
return err;
}
+
+
+/* another ergonomic helper for setup_funcs to use in res_setup baking */
+int til_setup_free_with_ret_err(til_setup_t *setup, int err)
+{
+ assert(err < 0);
+
+ til_setup_free(setup);
+
+ return err;
+}
diff --git a/src/til_setup.h b/src/til_setup.h
index eac1444..4491461 100644
--- a/src/til_setup.h
+++ b/src/til_setup.h
@@ -19,5 +19,6 @@ void * til_setup_new(const til_settings_t *settings, size_t size, void (*free_fu
void * til_setup_ref(til_setup_t *setup);
void * til_setup_free(til_setup_t *setup);
int til_setup_free_with_failed_setting_ret_err(til_setup_t *setup, til_setting_t *failed_setting, til_setting_t **res_setting, int err);
+int til_setup_free_with_ret_err(til_setup_t *setup, int err);
#endif
© All Rights Reserved