diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-04-24 16:51:59 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-04-24 16:51:59 -0700 |
commit | 23f54e51f5bb62ffa98383df996441c5852b5d2d (patch) | |
tree | bb73b9c45e7deb590c4f3f9a2845beebf1fbf17e | |
parent | 549fa449749803818a715f887d8e12ceeb985989 (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.
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/til_setup.h | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 733c459..9f3d400 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = libs modules noinst_LTLIBRARIES = libtil.la -libtil_la_SOURCES = til_args.c til_args.h til_fb.c til_fb.h til_knobs.h til.c til.h til_settings.h til_settings.c til_threads.c til_threads.h til_util.c til_util.h +libtil_la_SOURCES = til_args.c til_args.h til_fb.c til_fb.h til_knobs.h til.c til.h til_settings.h til_settings.c til_setup.h til_threads.c til_threads.h til_util.c til_util.h libtil_la_CPPFLAGS = -I@top_srcdir@/src libtil_la_LIBADD = modules/blinds/libblinds.la modules/checkers/libcheckers.la modules/compose/libcompose.la modules/drizzle/libdrizzle.la modules/flui2d/libflui2d.la modules/julia/libjulia.la modules/meta2d/libmeta2d.la modules/montage/libmontage.la modules/pixbounce/libpixbounce.la modules/plasma/libplasma.la modules/plato/libplato.la modules/ray/libray.la modules/roto/libroto.la modules/rtv/librtv.la modules/snow/libsnow.la modules/sparkler/libsparkler.la modules/spiro/libspiro.la modules/stars/libstars.la modules/submit/libsubmit.la modules/swab/libswab.la modules/swarm/libswarm.la libs/grid/libgrid.la libs/puddle/libpuddle.la libs/ray/libray.la libs/sig/libsig.la libs/txt/libtxt.la libs/ascii/libascii.la libs/din/libdin.la 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 |