X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fdaemon%2Fplugin.c;h=7c6cf82906956107d3641175a17d5f29af009b3e;hp=ae99d5fdfa13bb9aef4b7d6efb994dcb6078e01b;hb=7b8851b26928b609ce850e78c1eabb50ff319244;hpb=a1b19a64325554b0410daaefed3ce229b34958b7 diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c index ae99d5fd..7c6cf829 100644 --- a/src/daemon/plugin.c +++ b/src/daemon/plugin.c @@ -646,7 +646,7 @@ static void start_read_threads(size_t num) /* {{{ */ } char name[THREAD_NAME_MAX]; - snprintf(name, sizeof(name), "reader#%zu", read_threads_num); + snprintf(name, sizeof(name), "reader#%" PRIsz, read_threads_num); set_thread_name(read_threads[read_threads_num], name); read_threads_num++; @@ -657,7 +657,7 @@ static void stop_read_threads(void) { if (read_threads == NULL) return; - INFO("collectd: Stopping %zu read threads.", read_threads_num); + INFO("collectd: Stopping %" PRIsz " read threads.", read_threads_num); pthread_mutex_lock(&read_lock); read_loop = 0; @@ -853,7 +853,7 @@ static void start_write_threads(size_t num) /* {{{ */ } char name[THREAD_NAME_MAX]; - snprintf(name, sizeof(name), "writer#%zu", write_threads_num); + snprintf(name, sizeof(name), "writer#%" PRIsz, write_threads_num); set_thread_name(write_threads[write_threads_num], name); write_threads_num++; @@ -868,7 +868,7 @@ static void stop_write_threads(void) /* {{{ */ if (write_threads == NULL) return; - INFO("collectd: Stopping %zu write threads.", write_threads_num); + INFO("collectd: Stopping %" PRIsz " write threads.", write_threads_num); pthread_mutex_lock(&write_lock); write_loop = 0; @@ -900,7 +900,7 @@ static void stop_write_threads(void) /* {{{ */ pthread_mutex_unlock(&write_lock); if (i > 0) { - WARNING("plugin: %zu value list%s left after shutting down " + WARNING("plugin: %" PRIsz " value list%s left after shutting down " "the write threads.", i, (i == 1) ? " was" : "s were"); } @@ -1322,8 +1322,7 @@ int plugin_register_missing(const char *name, plugin_missing_cb callback, } /* int plugin_register_missing */ int plugin_register_shutdown(const char *name, int (*callback)(void)) { - return create_register_callback(&list_shutdown, name, (void *)callback, - NULL); + return create_register_callback(&list_shutdown, name, (void *)callback, NULL); } /* int plugin_register_shutdown */ static void plugin_free_data_sets(void) { @@ -1874,23 +1873,16 @@ int plugin_shutdown_all(void) { int plugin_dispatch_missing(const value_list_t *vl) /* {{{ */ { - llentry_t *le; - if (list_missing == NULL) return 0; - le = llist_head(list_missing); + llentry_t *le = llist_head(list_missing); while (le != NULL) { - callback_func_t *cf; - plugin_missing_cb callback; - plugin_ctx_t old_ctx; - int status; + callback_func_t *cf = le->value; + plugin_ctx_t old_ctx = plugin_set_ctx(cf->cf_ctx); + plugin_missing_cb callback = cf->cf_callback; - cf = le->value; - old_ctx = plugin_set_ctx(cf->cf_ctx); - callback = cf->cf_callback; - - status = (*callback)(vl, &cf->cf_udata); + int status = (*callback)(vl, &cf->cf_udata); plugin_set_ctx(old_ctx); if (status != 0) { if (status < 0) { @@ -1912,8 +1904,6 @@ static int plugin_dispatch_values_internal(value_list_t *vl) { int status; static c_complain_t no_write_complaint = C_COMPLAIN_INIT_STATIC; - data_set_t *ds; - _Bool free_meta_data = 0; assert(vl != NULL); @@ -1949,6 +1939,7 @@ static int plugin_dispatch_values_internal(value_list_t *vl) { return -1; } + data_set_t *ds = NULL; if (c_avl_get(data_sets, vl->type, (void *)&ds) != 0) { char ident[6 * DATA_MAX_NAME_LEN]; @@ -1979,8 +1970,8 @@ static int plugin_dispatch_values_internal(value_list_t *vl) { #else if (ds->ds_num != vl->values_len) { ERROR("plugin_dispatch_values: ds->type = %s: " - "(ds->ds_num = %zu) != " - "(vl->values_len = %zu)", + "(ds->ds_num = %" PRIsz ") != " + "(vl->values_len = %" PRIsz ")", ds->type, ds->ds_num, vl->values_len); return -1; }