Merge remote-tracking branch 'origin/collectd-5.2' into collectd-5.2
authorFlorian Forster <octo@collectd.org>
Wed, 16 Jan 2013 12:26:46 +0000 (13:26 +0100)
committerFlorian Forster <octo@collectd.org>
Wed, 16 Jan 2013 12:26:46 +0000 (13:26 +0100)
1  2 
src/write_graphite.c

diff --combined src/write_graphite.c
@@@ -85,9 -85,7 +85,7 @@@ struct wg_callbac
      char    *postfix;
      char     escape_char;
  
-     _Bool    store_rates;
-     _Bool    separate_instances;
-     _Bool    always_append_ds;
+     unsigned int format_flags;
  
      char     send_buf[WG_SEND_BUF_SIZE];
      size_t   send_buf_free;
@@@ -340,7 -338,7 +338,7 @@@ static int wg_send_message (char const 
  static int wg_write_messages (const data_set_t *ds, const value_list_t *vl,
          struct wg_callback *cb)
  {
 -    char buffer[4096];
 +    char buffer[WG_SEND_BUF_SIZE];
      int status;
  
      if (0 != strcmp (ds->type, vl->type))
  
      memset (buffer, 0, sizeof (buffer));
      status = format_graphite (buffer, sizeof (buffer), ds, vl,
-             cb->prefix, cb->postfix, cb->escape_char, cb->store_rates);
+             cb->prefix, cb->postfix, cb->escape_char, cb->format_flags);
      if (status != 0) /* error message has been printed already. */
          return (status);
  
@@@ -434,7 -432,7 +432,7 @@@ static int wg_config_carbon (oconfig_it
      cb->prefix = NULL;
      cb->postfix = NULL;
      cb->escape_char = WG_DEFAULT_ESCAPE;
-     cb->store_rates = 1;
+     cb->format_flags = GRAPHITE_STORE_RATES;
  
      pthread_mutex_init (&cb->send_lock, /* attr = */ NULL);
  
          else if (strcasecmp ("Postfix", child->key) == 0)
              cf_util_get_string (child, &cb->postfix);
          else if (strcasecmp ("StoreRates", child->key) == 0)
-             cf_util_get_boolean (child, &cb->store_rates);
+             cf_util_get_flag (child, &cb->format_flags,
+                     GRAPHITE_STORE_RATES);
          else if (strcasecmp ("SeparateInstances", child->key) == 0)
-             cf_util_get_boolean (child, &cb->separate_instances);
+             cf_util_get_flag (child, &cb->format_flags,
+                     GRAPHITE_SEPARATE_INSTANCES);
          else if (strcasecmp ("AlwaysAppendDS", child->key) == 0)
-             cf_util_get_boolean (child, &cb->always_append_ds);
+             cf_util_get_flag (child, &cb->format_flags,
+                     GRAPHITE_ALWAYS_APPEND_DS);
          else if (strcasecmp ("EscapeCharacter", child->key) == 0)
              config_set_char (&cb->escape_char, child);
          else