[Olsr-dev] [PATCH v1 011/115] jsoninfo: use standard set_plugin_string function for uuidfile parameter

Ferry Huberts (spam-protected)
Wed Dec 2 21:27:44 CET 2015


From: Ferry Huberts <(spam-protected)>

Not the custom store_string function

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/jsoninfo/src/olsrd_plugin.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lib/jsoninfo/src/olsrd_plugin.c b/lib/jsoninfo/src/olsrd_plugin.c
index f8381e2..f1041f1 100644
--- a/lib/jsoninfo/src/olsrd_plugin.c
+++ b/lib/jsoninfo/src/olsrd_plugin.c
@@ -113,20 +113,14 @@ int olsrd_plugin_interface_version(void) {
   return PLUGIN_INTERFACE_VERSION;
 }
 
-static int store_string(const char *value, void *data, set_plugin_parameter_addon addon __attribute__ ((unused))) {
-  char *str = data;
-  snprintf(str, FILENAME_MAX, "%s", value);
-  return 0;
-}
-
 static const struct olsrd_plugin_parameters plugin_parameters[] = { //
     //
         { .name = "port", .set_plugin_parameter = &set_plugin_port, .data = &ipc_port }, //
         { .name = "accept", .set_plugin_parameter = &set_plugin_ipaddress, .data = &jsoninfo_accept_ip }, //
         { .name = "listen", .set_plugin_parameter = &set_plugin_ipaddress, .data = &jsoninfo_listen_ip }, //
-        { .name = "uuidfile", .set_plugin_parameter = &store_string, .data = uuidfile }, //
         { .name = "httpheaders", .set_plugin_parameter = &set_plugin_boolean, .data = &http_headers }, //
-        { .name = "ipv6only", .set_plugin_parameter = &set_plugin_boolean, .data = &jsoninfo_ipv6_only } //
+        { .name = "ipv6only", .set_plugin_parameter = &set_plugin_boolean, .data = &jsoninfo_ipv6_only }, //
+        { .name = "uuidfile", .set_plugin_parameter = &set_plugin_string, .data = uuidfile, .addon = { .ui = FILENAME_MAX - 1 } } //
     };
 
 void olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size) {
-- 
2.5.0




More information about the Olsr-dev mailing list