summaryrefslogtreecommitdiff
path: root/bus/config-parser.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-07-23 17:33:24 +0100
committerSimon McVittie <smcv@collabora.com>2018-08-02 15:26:27 +0100
commit46cdc12830c413a80ca13b1fae0a7dc1f8ced263 (patch)
tree8afa4c3641894b9c6aeaaf49ed60684b0c4f2fc2 /bus/config-parser.c
parent7efc06293ab8a6bf4aba50dac0da55e4a583360a (diff)
downloaddbus-46cdc12830c413a80ca13b1fae0a7dc1f8ced263.tar.gz
Add and use _dbus_list_clear_full
In gcc 8, -Wall -Wextra includes -Wcast-function-type, which warns about passing an extra (unwanted) parameter to callbacks. Instead of using _dbus_list_foreach(), add a function to do what we actually wanted here. Signed-off-by: Simon McVittie <smcv@collabora.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107349 Reviewed-by: Thiago Macieira <thiago@kde.org>
Diffstat (limited to 'bus/config-parser.c')
-rw-r--r--bus/config-parser.c40
1 files changed, 8 insertions, 32 deletions
diff --git a/bus/config-parser.c b/bus/config-parser.c
index f49ab1dc..4343b512 100644
--- a/bus/config-parser.c
+++ b/bus/config-parser.c
@@ -585,31 +585,13 @@ bus_config_parser_unref (BusConfigParser *parser)
dbus_free (parser->servicehelper);
dbus_free (parser->bus_type);
dbus_free (parser->pidfile);
-
- _dbus_list_foreach (&parser->listen_on,
- (DBusForeachFunction) dbus_free,
- NULL);
-
- _dbus_list_clear (&parser->listen_on);
-
- _dbus_list_foreach (&parser->service_dirs,
- (DBusForeachFunction) bus_config_service_dir_free,
- NULL);
-
- _dbus_list_clear (&parser->service_dirs);
- _dbus_list_foreach (&parser->conf_dirs,
- (DBusForeachFunction) dbus_free,
- NULL);
+ _dbus_list_clear_full (&parser->listen_on, dbus_free);
+ _dbus_list_clear_full (&parser->service_dirs,
+ (DBusFreeFunction) bus_config_service_dir_free);
+ _dbus_list_clear_full (&parser->conf_dirs, dbus_free);
+ _dbus_list_clear_full (&parser->mechanisms, dbus_free);
- _dbus_list_clear (&parser->conf_dirs);
-
- _dbus_list_foreach (&parser->mechanisms,
- (DBusForeachFunction) dbus_free,
- NULL);
-
- _dbus_list_clear (&parser->mechanisms);
-
_dbus_string_free (&parser->basedir);
if (parser->policy)
@@ -929,9 +911,7 @@ start_busconfig_child (BusConfigParser *parser,
BUS_SERVICE_DIR_FLAGS_STRICT_NAMING))
{
BUS_SET_OOM (error);
- _dbus_list_foreach (&dirs, (DBusForeachFunction) dbus_free,
- NULL);
- _dbus_list_clear (&dirs);
+ _dbus_list_clear_full (&dirs, dbus_free);
return FALSE;
}
}
@@ -958,9 +938,7 @@ start_busconfig_child (BusConfigParser *parser,
BUS_SERVICE_DIR_FLAGS_NONE))
{
BUS_SET_OOM (error);
- _dbus_list_foreach (&dirs, (DBusForeachFunction) dbus_free,
- NULL);
- _dbus_list_clear (&dirs);
+ _dbus_list_clear_full (&dirs, dbus_free);
return FALSE;
}
@@ -996,9 +974,7 @@ start_busconfig_child (BusConfigParser *parser,
BUS_SERVICE_DIR_FLAGS_NONE))
{
BUS_SET_OOM (error);
- _dbus_list_foreach (&dirs, (DBusForeachFunction) dbus_free,
- NULL);
- _dbus_list_clear (&dirs);
+ _dbus_list_clear_full (&dirs, dbus_free);
return FALSE;
}