[collectd] Fix compilation error with plugin_register_shutdown

Bruno Prémont bonbons at linux-vserver.org
Fri Mar 18 08:24:40 CET 2011

Compiling collectd-4.10.2 on an OpenSuSE 11.3 system causes the
following error:
  snmp.c: In function ‘module_register’:
  snmp.c:1620:3: error: passing argument 1 of ‘plugin_register_shutdown’ discards qualifiers from pointer target type
  plugin.h:275:5: note: expected ‘char *’ but argument is of type ‘const char *’

Convert plugin_register_shutdown's name argument from 'char *' to
'const char *' in order to match the other plugin_register_*

Signed-off-by: Bruno Prémont <bonbons at linux-vserver.org>


diff --git a/src/plugin.c b/src/plugin.c
index af894d5..8ea30dd 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -842,7 +842,7 @@ int plugin_register_flush (const char *name,
 				(void *) callback, ud));
 } /* int plugin_register_flush */
-int plugin_register_shutdown (char *name,
+int plugin_register_shutdown (const char *name,
 		int (*callback) (void))
 	return (create_register_callback (&list_shutdown, name,
diff --git a/src/plugin.h b/src/plugin.h
index 8b9449e..3f94dbc 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -272,7 +272,7 @@ int plugin_register_write (const char *name,
 		plugin_write_cb callback, user_data_t *user_data);
 int plugin_register_flush (const char *name,
 		plugin_flush_cb callback, user_data_t *user_data);
-int plugin_register_shutdown (char *name,
+int plugin_register_shutdown (const char *name,
 		plugin_shutdown_cb callback);
 int plugin_register_data_set (const data_set_t *ds);
 int plugin_register_log (const char *name,

More information about the collectd mailing list