From 099f87e0154f85daac03223ca30f59d004a14f9d Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 21 Aug 2009 10:23:30 +0200 Subject: [PATCH] http plugin: Use the `FORMAT_VL' macro. --- src/http.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/http.c b/src/http.c index 60535ba8..8add24b3 100644 --- a/src/http.c +++ b/src/http.c @@ -257,7 +257,6 @@ static int http_flush_buffer (void) /* {{{ */ static int http_write (const data_set_t *ds, const value_list_t *vl, /* {{{ */ user_data_t __attribute__((unused)) *user_data) { - char key[1024]; char values[512]; @@ -268,16 +267,13 @@ static int http_write (const data_set_t *ds, const value_list_t *vl, /* {{{ */ return -1; } - status = format_name( key, sizeof(key), vl->host, vl->plugin, - vl->plugin_instance, vl->type, vl->type_instance ); - + status = FORMAT_VL (key, sizeof (key), vl); if (status != 0) { ERROR ("http plugin: error with format_name"); return (status); } status = http_value_list_to_string (values, sizeof (values), ds, vl); - if (status != 0) { ERROR ("http plugin: error with http_value_list_to_string"); return (status); @@ -286,9 +282,11 @@ static int http_write (const data_set_t *ds, const value_list_t *vl, /* {{{ */ pthread_mutex_lock (&send_lock); - status = ssnprintf (send_buffer + send_buffer_fill, sizeof (send_buffer) - send_buffer_fill, - "PUTVAL %s interval=%i %u%s\n", - key, interval_g, vl->time, values); + /* `values' has a leading `:'. */ + status = ssnprintf (send_buffer + send_buffer_fill, + sizeof (send_buffer) - send_buffer_fill, + "PUTVAL %s interval=%i %lu%s\n", + key, interval_g, (unsigned long) vl->time, values); send_buffer_fill += status; if ((sizeof (send_buffer) - send_buffer_fill) < (sizeof(key) + sizeof(values))) -- 2.30.2