[Olsr-dev] [PATCH v1 067/115] info: use a define for the info_plugin_config_t plugin parameters

Ferry Huberts (spam-protected)
Wed Dec 2 21:28:40 CET 2015


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/info/info_types.h           | 10 +++++++++-
 lib/jsoninfo/src/olsrd_plugin.c |  8 +-------
 lib/txtinfo/src/olsrd_plugin.c  |  7 +------
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/lib/info/info_types.h b/lib/info/info_types.h
index a4aaa89..38dcb0c 100644
--- a/lib/info/info_types.h
+++ b/lib/info/info_types.h
@@ -110,4 +110,12 @@ typedef struct {
     int ipv6_only;
 } info_plugin_config_t;
 
-#endif /* _OLSRD_LIB_INFO_INFO_TYPES_H_ */
+#define INFO_PLUGIN_CONFIG_PLUGIN_PARAMETERS \
+  { .name = "port", .set_plugin_parameter = &set_plugin_port, .data = &config.ipc_port }, \
+  { .name = "accept", .set_plugin_parameter = &set_plugin_ipaddress, .data = &config.accept_ip }, \
+  { .name = "listen", .set_plugin_parameter = &set_plugin_ipaddress, .data = &config.listen_ip }, \
+  { .name = "httpheaders", .set_plugin_parameter = &set_plugin_boolean, .data = &config.http_headers }, \
+  { .name = "allowlocalhost", .set_plugin_parameter = &set_plugin_boolean, .data = &config.allow_localhost }, \
+  { .name = "ipv6only", .set_plugin_parameter = &set_plugin_boolean, .data = &config.ipv6_only }
+
+  #endif /* _OLSRD_LIB_INFO_INFO_TYPES_H_ */
diff --git a/lib/jsoninfo/src/olsrd_plugin.c b/lib/jsoninfo/src/olsrd_plugin.c
index 5f86bc2..0999b5c 100644
--- a/lib/jsoninfo/src/olsrd_plugin.c
+++ b/lib/jsoninfo/src/olsrd_plugin.c
@@ -75,7 +75,6 @@ static info_plugin_functions_t functions = { //
         .plugins = &ipc_print_plugins //
     };
 
-
 info_plugin_config_t config;
 char uuidfile[FILENAME_MAX];
 
@@ -145,12 +144,7 @@ int olsrd_plugin_interface_version(void) {
 
 static const struct olsrd_plugin_parameters plugin_parameters[] = { //
     //
-        { .name = "port", .set_plugin_parameter = &set_plugin_port, .data = &config.ipc_port }, //
-        { .name = "accept", .set_plugin_parameter = &set_plugin_ipaddress, .data = &config.accept_ip }, //
-        { .name = "listen", .set_plugin_parameter = &set_plugin_ipaddress, .data = &config.listen_ip }, //
-        { .name = "httpheaders", .set_plugin_parameter = &set_plugin_boolean, .data = &config.http_headers }, //
-        { .name = "allowlocalhost", .set_plugin_parameter = &set_plugin_boolean, .data = &config.allow_localhost }, //
-        { .name = "ipv6only", .set_plugin_parameter = &set_plugin_boolean, .data = &config.ipv6_only }, //
+        INFO_PLUGIN_CONFIG_PLUGIN_PARAMETERS, //
         { .name = "uuidfile", .set_plugin_parameter = &set_plugin_string, .data = uuidfile, .addon = { .ui = FILENAME_MAX - 1 } } //
     };
 
diff --git a/lib/txtinfo/src/olsrd_plugin.c b/lib/txtinfo/src/olsrd_plugin.c
index 9c891f7..956f7ea 100644
--- a/lib/txtinfo/src/olsrd_plugin.c
+++ b/lib/txtinfo/src/olsrd_plugin.c
@@ -144,12 +144,7 @@ int olsrd_plugin_interface_version(void) {
 
 static const struct olsrd_plugin_parameters plugin_parameters[] = { //
     //
-        { .name = "port", .set_plugin_parameter = &set_plugin_port, .data = &config.ipc_port }, //
-        { .name = "accept", .set_plugin_parameter = &set_plugin_ipaddress, .data = &config.accept_ip }, //
-        { .name = "listen", .set_plugin_parameter = &set_plugin_ipaddress, .data = &config.listen_ip }, //
-        { .name = "httpheaders", .set_plugin_parameter = &set_plugin_boolean, .data = &config.http_headers }, //
-        { .name = "allowlocalhost", .set_plugin_parameter = &set_plugin_boolean, .data = &config.allow_localhost }, //
-        { .name = "ipv6only", .set_plugin_parameter = &set_plugin_boolean, .data = &config.ipv6_only }, //
+        INFO_PLUGIN_CONFIG_PLUGIN_PARAMETERS, //
         { .name = "vtime", .set_plugin_parameter = &set_plugin_boolean, .data = &vtime } //
     };
 
-- 
2.5.0




More information about the Olsr-dev mailing list