jsoninfo: simplify setup of plugin functions
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 14 Apr 2016 11:36:51 +0000 (13:36 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 14 Apr 2016 11:37:27 +0000 (13:37 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/jsoninfo/src/olsrd_plugin.c

index fe1118b..0034a2b 100644 (file)
 #define PLUGIN_TITLE             "OLSRD jsoninfo plugin"
 #define PLUGIN_INTERFACE_VERSION 5
 
-static info_plugin_functions_t functions = { //
-    //
-        .supportsCompositeCommands = true, //
-        .init = plugin_init, //
-        .supported_commands_mask = get_supported_commands_mask, //
-        .is_command = isCommand, //
-        .cache_timeout = cache_timeout_generic, //
-        .determine_mime_type = determine_mime_type, //
-        .output_start = output_start, //
-        .output_end = output_end, //
-        .output_error = output_error, //
-        .neighbors = ipc_print_neighbors, //
-        .links = ipc_print_links, //
-        .routes = ipc_print_routes, //
-        .topology = ipc_print_topology, //
-        .hna = ipc_print_hna, //
-        .mid = ipc_print_mid, //
-        .gateways = ipc_print_gateways, //
-        .sgw = ipc_print_sgw, //
-        .version = ipc_print_version, //
-        .olsrd_conf = ipc_print_olsrd_conf, //
-        .interfaces = ipc_print_interfaces, //
-        .twohop = ipc_print_twohop, //
-        .config = ipc_print_config, //
-        .plugins = ipc_print_plugins //
-    };
-
+info_plugin_functions_t functions;
 info_plugin_config_t config;
 char uuidfile[FILENAME_MAX];
 
@@ -116,6 +90,33 @@ static void my_fini(void) {
  *function in uolsrd_plugin.c
  */
 int olsrd_plugin_init(void) {
+  memset(&functions, 0, sizeof(functions));
+
+  functions.supportsCompositeCommands = true;
+  functions.init = plugin_init;
+  functions.supported_commands_mask = get_supported_commands_mask;
+  functions.is_command = isCommand;
+  functions.cache_timeout = cache_timeout_generic;
+  functions.determine_mime_type = determine_mime_type;
+  functions.output_start = output_start;
+  functions.output_end = output_end;
+  functions.output_error = output_error;
+
+  functions.neighbors = ipc_print_neighbors;
+  functions.links = ipc_print_links;
+  functions.routes = ipc_print_routes;
+  functions.topology = ipc_print_topology;
+  functions.hna = ipc_print_hna;
+  functions.mid = ipc_print_mid;
+  functions.gateways = ipc_print_gateways;
+  functions.sgw = ipc_print_sgw;
+  functions.version = ipc_print_version;
+  functions.olsrd_conf = ipc_print_olsrd_conf;
+  functions.interfaces = ipc_print_interfaces;
+  functions.twohop = ipc_print_twohop;
+  functions.config = ipc_print_config;
+  functions.plugins = ipc_print_plugins;
+
   return info_plugin_init(PLUGIN_NAME, &functions, &config);
 }