X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ftarget_scale.c;h=29fecdfd7b5818479437659982226c993934a63d;hb=cde09b547abbeb7595d91259fcc628504d0f55a9;hp=7ee4ca89ab7dd3c272446d9a76961ce618f966e2;hpb=9ae852ac617479e55d10604166deed22ccaf1b3d;p=collectd.git diff --git a/src/target_scale.c b/src/target_scale.c index 7ee4ca89..29fecdfd 100644 --- a/src/target_scale.c +++ b/src/target_scale.c @@ -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 */