diff options
author | Ariadne Conill <ariadne@dereferenced.org> | 2021-12-10 14:33:52 -0600 |
---|---|---|
committer | Ariadne Conill <ariadne@dereferenced.org> | 2021-12-14 12:05:59 -0600 |
commit | 3fd120db5c0f6e32740796a914945166d3d887fb (patch) | |
tree | c33be69d157a735e51d6de04cd4ed10dc5dae41d /src/apk_applet.h | |
parent | 980e58efc6828fb0fe2c83c64d6b76dc95b33813 (diff) | |
download | apk-tools-3fd120db5c0f6e32740796a914945166d3d887fb.tar.gz apk-tools-3fd120db5c0f6e32740796a914945166d3d887fb.tar.bz2 apk-tools-3fd120db5c0f6e32740796a914945166d3d887fb.tar.xz apk-tools-3fd120db5c0f6e32740796a914945166d3d887fb.zip |
applet: rework APK_DEFINE_APPLET to use constructor attribute
this allows the applet registration to work in a portable way, without having to
weird things with the linker.
ref #10794
Diffstat (limited to 'src/apk_applet.h')
-rw-r--r-- | src/apk_applet.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/apk_applet.h b/src/apk_applet.h index c3d5978..0d63712 100644 --- a/src/apk_applet.h +++ b/src/apk_applet.h @@ -56,14 +56,10 @@ struct apk_applet { extern const struct apk_option_group optgroup_global, optgroup_commit, optgroup_signing; void apk_applet_register(struct apk_applet *); -void apk_applet_register_builtin(void); struct apk_applet *apk_applet_find(const char *name); void apk_applet_help(struct apk_applet *applet, struct apk_out *out); -typedef void (*apk_init_func_t)(void); - #define APK_DEFINE_APPLET(x) \ -static void __register_##x(void) { apk_applet_register(&x); } \ -static apk_init_func_t __regfunc_##x __attribute__((__section__("initapplets"))) __attribute((used)) = __register_##x; +__attribute__((constructor)) static void __register_##x(void) { apk_applet_register(&x); } #endif |