From: Wolfgang Stöggl Date: Thu, 10 Jan 2019 16:06:21 +0000 (+0100) Subject: Use g_list_free_full instead of g_list_foreach X-Git-Tag: v1.7.1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78405cec24eab5c384ec331af8f0d666f5b7d95d;p=thirdparty%2Frrdtool-1.x.git Use g_list_free_full instead of g_list_foreach - 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); --- diff --git a/src/rrd_create.c b/src/rrd_create.c index d61b20d0..67cdc568 100644 --- a/src/rrd_create.c +++ b/src/rrd_create.c @@ -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;