Code

Fixed (pedantic) void-pointer to function-pointer cast warnings.
authorSebastian Harl <sh@tokkee.org>
Sun, 23 Feb 2014 20:37:07 +0000 (12:37 -0800)
committerSebastian Harl <sh@tokkee.org>
Sun, 23 Feb 2014 20:37:07 +0000 (12:37 -0800)
src/core/plugin.c
t/utils/unixsock_test.c

index 559e6eb4d7db1aa803a55783025d2dc4a8ee6afb..92440a5e69e913ebc8b63f1da8ccb0f370dffb45 100644 (file)
@@ -578,7 +578,7 @@ int
 sdb_plugin_register_config(const char *name, sdb_plugin_config_cb callback)
 {
        return plugin_add_callback(&config_list, "init", name,
-                       callback, NULL);
+                       (void *)callback, NULL);
 } /* sdb_plugin_register_config */
 
 int
@@ -586,7 +586,7 @@ sdb_plugin_register_init(const char *name, sdb_plugin_init_cb callback,
                sdb_object_t *user_data)
 {
        return plugin_add_callback(&init_list, "init", name,
-                       callback, user_data);
+                       (void *)callback, user_data);
 } /* sdb_plugin_register_init */
 
 int
@@ -594,14 +594,14 @@ sdb_plugin_register_shutdown(const char *name, sdb_plugin_shutdown_cb callback,
                sdb_object_t *user_data)
 {
        return plugin_add_callback(&shutdown_list, "shutdown", name,
-                       callback, user_data);
+                       (void *)callback, user_data);
 } /* sdb_plugin_register_shutdown */
 
 int
 sdb_plugin_register_log(const char *name, sdb_plugin_log_cb callback,
                sdb_object_t *user_data)
 {
-       return plugin_add_callback(&log_list, "log", name, callback,
+       return plugin_add_callback(&log_list, "log", name, (void *)callback,
                        user_data);
 } /* sdb_plugin_register_log */
 
@@ -609,7 +609,7 @@ int
 sdb_plugin_register_cname(const char *name, sdb_plugin_cname_cb callback,
                sdb_object_t *user_data)
 {
-       return plugin_add_callback(&cname_list, "cname", name, callback,
+       return plugin_add_callback(&cname_list, "cname", name, (void *)callback,
                        user_data);
 } /* sdb_plugin_register_cname */
 
@@ -725,7 +725,7 @@ sdb_plugin_configure(const char *name, oconfig_item_t *ci)
        }
 
        old_ctx = ctx_set(plugin->cb_ctx);
-       callback = plugin->cb_callback;
+       callback = (sdb_plugin_config_cb)plugin->cb_callback;
        status = callback(ci);
        ctx_set(old_ctx);
        return status;
@@ -747,7 +747,7 @@ sdb_plugin_init_all(void)
                assert(obj);
                cb = SDB_PLUGIN_CB(obj);
 
-               callback = cb->cb_callback;
+               callback = (sdb_plugin_init_cb)cb->cb_callback;
 
                old_ctx = ctx_set(cb->cb_ctx);
                if (callback(cb->cb_user_data)) {
@@ -784,7 +784,7 @@ sdb_plugin_collector_loop(sdb_plugin_loop_t *loop)
                if (! obj)
                        return -1;
 
-               callback = SDB_PLUGIN_CCB(obj)->ccb_callback;
+               callback = (sdb_plugin_collector_cb)SDB_PLUGIN_CCB(obj)->ccb_callback;
 
                if (! (now = sdb_gettime())) {
                        char errbuf[1024];
@@ -882,7 +882,7 @@ sdb_plugin_cname(char *hostname)
                sdb_object_t *obj = sdb_llist_iter_get_next(iter);
                assert(obj);
 
-               callback = SDB_PLUGIN_CB(obj)->cb_callback;
+               callback = (sdb_plugin_cname_cb)SDB_PLUGIN_CB(obj)->cb_callback;
                cname = callback(hostname, SDB_PLUGIN_CB(obj)->cb_user_data);
                if (cname) {
                        free(hostname);
@@ -914,7 +914,7 @@ sdb_plugin_log(int prio, const char *msg)
                sdb_object_t *obj = sdb_llist_iter_get_next(iter);
                assert(obj);
 
-               callback = SDB_PLUGIN_CB(obj)->cb_callback;
+               callback = (sdb_plugin_log_cb)SDB_PLUGIN_CB(obj)->cb_callback;
                tmp = callback(prio, msg, SDB_PLUGIN_CB(obj)->cb_user_data);
                if (tmp > ret)
                        ret = tmp;
index 4f1e0429e67ca338156597183fe2f6942b28bbcb..4502767868051bfb6ff33466b65f83283c0acdb8 100644 (file)
@@ -204,7 +204,9 @@ fdopen(int fd, const char *mode)
         * to use the original implementation */
        if (fd != myfd) {
                void *libc = dlopen_libc();
-               FILE *(*orig_fdopen)(int, const char *) = dlsym(libc, "fdopen");
+               FILE *(*orig_fdopen)(int, const char *);
+
+               orig_fdopen = (FILE *(*)(int, const char *))dlsym(libc, "fdopen");
 
                if (! orig_fdopen)
                        fail("INTERNAL ERROR: failed to load fdopen() from libc");