From 7f2501334d5fba1908c2d8bd46bafd0f5a7fc570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 12 Jan 2019 20:34:43 +0100 Subject: [PATCH] modules: use the same name for the module_info in all modules --- modules/alsa/alsa.c | 2 +- modules/backlight/backlight.c | 2 +- modules/battery/battery.c | 2 +- modules/clock/clock.c | 2 +- modules/i3/i3.c | 2 +- modules/label/label.c | 2 +- modules/mpd/mpd.c | 2 +- modules/network/network.c | 2 +- modules/removables/removables.c | 2 +- modules/xkb/xkb.c | 2 +- modules/xwindow/xwindow.c | 2 +- plugin.c | 6 +----- 12 files changed, 12 insertions(+), 16 deletions(-) diff --git a/modules/alsa/alsa.c b/modules/alsa/alsa.c index 5a34346..856d7fe 100644 --- a/modules/alsa/alsa.c +++ b/modules/alsa/alsa.c @@ -282,7 +282,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font) conf_to_particle(content, parent_font)); } -const struct module_info module_alsa = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 4, .attrs = { diff --git a/modules/backlight/backlight.c b/modules/backlight/backlight.c index 1ba2334..f8f9975 100644 --- a/modules/backlight/backlight.c +++ b/modules/backlight/backlight.c @@ -226,7 +226,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font) yml_value_as_string(name), conf_to_particle(c, parent_font)); } -const struct module_info module_backlight = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 3, .attrs = { diff --git a/modules/battery/battery.c b/modules/battery/battery.c index 98981c7..69bb4ea 100644 --- a/modules/battery/battery.c +++ b/modules/battery/battery.c @@ -358,7 +358,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font) poll_interval != NULL ? yml_value_as_int(poll_interval) : 60); } -const struct module_info module_battery = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 4, .attrs = { diff --git a/modules/clock/clock.c b/modules/clock/clock.c index 1bd3c36..74c1664 100644 --- a/modules/clock/clock.c +++ b/modules/clock/clock.c @@ -108,7 +108,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font) time_format != NULL ? yml_value_as_string(time_format) : "%H:%M"); } -const struct module_info module_clock = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 4, .attrs = { diff --git a/modules/i3/i3.c b/modules/i3/i3.c index a805c79..f3f52c2 100644 --- a/modules/i3/i3.c +++ b/modules/i3/i3.c @@ -703,7 +703,7 @@ verify_content(keychain_t *chain, const struct yml_node *node) return true; } -const struct module_info module_i3 = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 5, .attrs = { diff --git a/modules/label/label.c b/modules/label/label.c index 0533fa5..3f97216 100644 --- a/modules/label/label.c +++ b/modules/label/label.c @@ -55,7 +55,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font) return label_new(conf_to_particle(c, parent_font)); } -const struct module_info module_label = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 2, .attrs = { diff --git a/modules/mpd/mpd.c b/modules/mpd/mpd.c index f52b7c7..a17008d 100644 --- a/modules/mpd/mpd.c +++ b/modules/mpd/mpd.c @@ -493,7 +493,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font) conf_to_particle(c, parent_font)); } -const struct module_info module_mpd = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 4, .attrs = { diff --git a/modules/network/network.c b/modules/network/network.c index 273b688..0444c70 100644 --- a/modules/network/network.c +++ b/modules/network/network.c @@ -545,7 +545,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font) yml_value_as_string(name), conf_to_particle(content, parent_font)); } -const struct module_info module_network = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 3, .attrs = { diff --git a/modules/removables/removables.c b/modules/removables/removables.c index 92e3155..2b64707 100644 --- a/modules/removables/removables.c +++ b/modules/removables/removables.c @@ -579,7 +579,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font) conf_to_particle(content, parent_font), left, right); } -const struct module_info module_removables = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 5, .attrs = { diff --git a/modules/xkb/xkb.c b/modules/xkb/xkb.c index 5410e43..b299a80 100644 --- a/modules/xkb/xkb.c +++ b/modules/xkb/xkb.c @@ -461,7 +461,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font) return xkb_new(conf_to_particle(c, parent_font)); } -const struct module_info module_xkb = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 2, .attrs = { diff --git a/modules/xwindow/xwindow.c b/modules/xwindow/xwindow.c index d118b1e..4114e69 100644 --- a/modules/xwindow/xwindow.c +++ b/modules/xwindow/xwindow.c @@ -323,7 +323,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font) return xwindow_new(conf_to_particle(c, parent_font)); } -const struct module_info module_xwindow = { +const struct module_info module_info = { .from_conf = &from_conf, .attr_count = 2, .attrs = { diff --git a/plugin.c b/plugin.c index 9b9e58c..8eb2781 100644 --- a/plugin.c +++ b/plugin.c @@ -61,12 +61,8 @@ plugin_load_module(const char *name) tll_push_back(libs, ((struct plugin){strdup(name), lib})); struct plugin *plug = &tll_back(libs); - /* TODO: use same name in all modules */ - char sym[128]; - snprintf(sym, sizeof(sym), "module_%s", name); - dlerror(); /* Clear previous error */ - plug->sym = dlsym(lib, sym); + plug->sym = dlsym(lib, "module_info"); const char *dlsym_error = dlerror(); if (dlsym_error != NULL) {