]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Use g_list_free_full instead of g_list_foreach
authorWolfgang Stöggl <c72578@yahoo.de>
Thu, 10 Jan 2019 16:06:21 +0000 (17:06 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Fri, 11 Jan 2019 02:32:34 +0000 (03:32 +0100)
- Fixes the following compiler warnings in rrd_create.c:
  236:34: warning: cast between incompatible function types from
  'void (*)(void *)' to 'void (*)(void *, void *)'
  [-Wcast-function-type] g_list_foreach( sources, (GFunc)free, NULL );

  1022:44: warning: cast between incompatible function types from
  'void (*)(rrd_file_t *)' {aka 'void (*)(struct rrd_file_t *)'} to
  'void (*)(void *, void *)' [-Wcast-function-type]
  g_list_foreach(sources_rrd_files, (GFunc) cleanup_source_file, NULL);

src/rrd_create.c

index d61b20d03d96aae72d2716afba4d435818e68d93..67cdc56846ae5f3f34b4190974117d3ac03124c2 100644 (file)
@@ -233,8 +233,7 @@ done:
     }
     if (sources != NULL) {
         // this will free the list elements as well
-        g_list_foreach( sources, (GFunc)free, NULL );
-        g_list_free( sources );
+        g_list_free_full ( sources, (GDestroyNotify) free );
         sources = NULL;
     }
     if (template != NULL) {
@@ -1019,8 +1018,7 @@ int rrd_create_r2(
     rc = write_rrd(filename, &rrd);
     
 done:
-        g_list_foreach( sources_rrd_files, (GFunc) cleanup_source_file, NULL );
-        g_list_free( sources_rrd_files );
+        g_list_free_full ( sources_rrd_files, (GDestroyNotify) cleanup_source_file );
             
     if (mappings) {
         int ii;