summaryrefslogtreecommitdiff
path: root/src/til_setup.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-04-24 16:51:59 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-04-24 16:51:59 -0700
commit23f54e51f5bb62ffa98383df996441c5852b5d2d (patch)
treebb73b9c45e7deb590c4f3f9a2845beebf1fbf17e /src/til_setup.h
parent549fa449749803818a715f887d8e12ceeb985989 (diff)
til_setup: introduce til_setup_t
Preparatory commit for providing a res_setup type to replace void*. The impetus for this isn't just pursuit of less void*, but primarily implementing setup freeing by embedding this struct into the private setup types. An alternative method of adding setup freeing would have been to introduce something like til_module_t.free_setup(). But that would require having the til_module_t on hand, and the whole setup machinery is more generalized than til_module_t anyways. This way anything can simply embed the struct in their private setup instance and return the pointer to that in *res_setup. They should always be able to find their containing struct's offset from the til_setup_t* they returned. Either by using container_of(), or simply placing it at the start of the private setup struct.
Diffstat (limited to 'src/til_setup.h')
-rw-r--r--src/til_setup.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/til_setup.h b/src/til_setup.h
new file mode 100644
index 0000000..7984dd1
--- /dev/null
+++ b/src/til_setup.h
@@ -0,0 +1,10 @@
+#ifndef _TIL_SETUP_H
+#define _TIL_SETUP_H
+
+typedef struct til_setup_t til_setup_t;
+
+struct til_setup_t {
+ void (*free)(til_setup_t *setup);
+};
+
+#endif
© All Rights Reserved