curl_json plugin: Add compatibility code for libyajl v2.
[collectd.git] / src / target_scale.c
index 7ee4ca8..29fecdf 100644 (file)
@@ -1,6 +1,6 @@
 /**
- * collectd - src/target_set.c
- * Copyright (C) 2008  Florian Forster
+ * collectd - src/target_scale.c
+ * Copyright (C) 2008-2009  Florian Forster
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -87,10 +87,10 @@ static int ts_invoke_counter (const data_set_t *ds, value_list_t *vl, /* {{{ */
                /* Calcualte the rate */
                if (prev_counter > curr_counter) /* => counter overflow */
                {
-                       if (prev_counter <= 4294967295) /* 32 bit overflow */
-                               difference = (4294967295 - prev_counter) + curr_counter;
+                       if (prev_counter <= 4294967295UL) /* 32 bit overflow */
+                               difference = (4294967295UL - prev_counter) + curr_counter;
                        else /* 64 bit overflow */
-                               difference = (18446744073709551615U - prev_counter) + curr_counter;
+                               difference = (18446744073709551615ULL - prev_counter) + curr_counter;
                }
                else /* no overflow */
                {
@@ -302,11 +302,15 @@ static int ts_config_set_double (double *ret, oconfig_item_t *ci) /* {{{ */
 
 static int ts_destroy (void **user_data) /* {{{ */
 {
+       ts_data_t **data;
+
        if (user_data == NULL)
                return (-EINVAL);
 
-       free (*user_data);
-       *user_data = NULL;
+       data = (ts_data_t **) user_data;
+
+       free (*data);
+       *data = NULL;
 
        return (0);
 } /* }}} int ts_destroy */