Merge branch 'collectd-4.1' into collectd-4.2
authorFlorian Forster <octo@huhu.verplant.org>
Mon, 18 Feb 2008 19:53:44 +0000 (20:53 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Mon, 18 Feb 2008 19:53:44 +0000 (20:53 +0100)
1  2 
src/rrdtool.c

diff --combined src/rrdtool.c
@@@ -654,8 -654,6 +654,8 @@@ static void *rrd_queue_thread (void *da
  
                /* Write the values to the RRD-file */
                srrd_update (queue_entry->filename, NULL, values_num, values);
 +              DEBUG ("rrdtool plugin: queue thread: Wrote %i values to %s",
 +                              values_num, queue_entry->filename);
  
                for (i = 0; i < values_num; i++)
                {
@@@ -893,6 -891,19 +893,19 @@@ static int rrd_cache_insert (const cha
        return (0);
  } /* int rrd_cache_insert */
  
+ static int rrd_compare_numeric (const void *a_ptr, const void *b_ptr)
+ {
+       int a = *((int *) a_ptr);
+       int b = *((int *) b_ptr);
+       if (a < b)
+               return (-1);
+       else if (a > b)
+               return (1);
+       else
+               return (0);
+ } /* int rrd_compare_numeric */
  static int rrd_write (const data_set_t *ds, const value_list_t *vl)
  {
        struct stat  statbuf;
@@@ -1031,6 -1042,12 +1044,12 @@@ static int rrd_config (const char *key
                        if (rra_timespans_custom[rra_timespans_custom_num] != 0)
                                rra_timespans_custom_num++;
                } /* while (strtok_r) */
+               qsort (/* base = */ rra_timespans_custom,
+                               /* nmemb  = */ rra_timespans_custom_num,
+                               /* size   = */ sizeof (rra_timespans_custom[0]),
+                               /* compar = */ rrd_compare_numeric);
                free (value_copy);
        }
        else if (strcasecmp ("XFF", key) == 0)