diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2025-08-01 19:59:54 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-08-01 19:59:54 +0530 |
commit | eec951a2f92d18260acef6d421ee059d0511673b (patch) | |
tree | ac4e27d96d245184b643adc0606e50a305f36a1e | |
parent | 62636d863fb6577b67d49c84992685d77a30655f (diff) |
util: get_wrapped->unwrap
-rw-r--r-- | include/util.h | 2 | ||||
-rw-r--r-- | src/config.c | 2 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/msg.c | 7 | ||||
-rw-r--r-- | src/template.c | 2 | ||||
-rw-r--r-- | src/util.c | 2 |
6 files changed, 9 insertions, 10 deletions
diff --git a/include/util.h b/include/util.h index 4310bdb..d3c26a1 100644 --- a/include/util.h +++ b/include/util.h @@ -27,6 +27,6 @@ char *ltrim(char *s); char *rtrim(char *s); char *trim(char *s); ptr_wrapper_t *wrap_ptr(void *ptr); -void *get_wrapped(ptr_wrapper_t *wrapper); +void *unwrap(ptr_wrapper_t *wrapper); #endif diff --git a/src/config.c b/src/config.c index ad25756..0d09bb1 100644 --- a/src/config.c +++ b/src/config.c @@ -89,7 +89,7 @@ config_delete(config_t *config) if (wrapper->ptr != NULL) free(wrapper->ptr); - list_t *l = get_wrapped(list_get(config->array_values, i)); + list_t *l = unwrap(list_get(config->array_values, i)); if (l != NULL) { for (size_t y = 0; y < l->size; y++) { wrapper = list_get(l, y); @@ -184,7 +184,7 @@ main(int argc, char **argv) if (*wd == event->wd) { char *directory_name; - char *name = get_wrapped(list_get(directory_names, i)); + char *name = unwrap(list_get(directory_names, i)); asprintf(&directory_name, "%s/%s", name, event->name); add_directory_to_watch(directory_name); @@ -200,7 +200,7 @@ main(int argc, char **argv) } for (size_t i = 0; i < wds->size; i++) { - char *name = get_wrapped(list_get(directory_names, i)); + char *name = unwrap(list_get(directory_names, i)); free(name); } list_delete(wds); @@ -158,7 +158,7 @@ run(void) return EXIT_FAILURE; } - list_t *static_ = get_wrapped(list_find_corresponding_value_from_ptr_wrapper( + list_t *static_ = unwrap(list_find_corresponding_value_from_ptr_wrapper( config->keys, config->array_values, "static")); if (static_ == NULL) { @@ -183,9 +183,8 @@ run(void) free(path); } - list_t *resources - = get_wrapped(list_find_corresponding_value_from_ptr_wrapper( - config->keys, config->array_values, "resources")); + list_t *resources = unwrap(list_find_corresponding_value_from_ptr_wrapper( + config->keys, config->array_values, "resources")); if (resources == NULL) { printf("Could not find resources in config.cfg\n"); diff --git a/src/template.c b/src/template.c index 838ed43..877ca07 100644 --- a/src/template.c +++ b/src/template.c @@ -139,7 +139,7 @@ template_write(engine_t *engine, FILE *f, void *doc, bool is_markdown) if (engine != NULL && engine->config != NULL) { char *template_name - = get_wrapped(list_find_corresponding_value_from_ptr_wrapper( + = unwrap(list_find_corresponding_value_from_ptr_wrapper( engine->config->keys, engine->config->values, "template")); if (template_name != NULL) { @@ -54,7 +54,7 @@ wrap_ptr(void *ptr) } void * -get_wrapped(ptr_wrapper_t *wrapper) +unwrap(ptr_wrapper_t *wrapper) { if (wrapper == NULL) return NULL; |