summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-04-05 18:46:54 +0200
committerThomas Haller <thaller@redhat.com>2017-04-05 18:50:45 +0200
commit755cebeb498f0dc7fe35adae281c4cbe028a3ce9 (patch)
tree8b97816d4910c0ae74892bc7aa35220570341666
parent45ee2b0fa1a3c3d90840270922eb6a5e1f6adc95 (diff)
downloadNetworkManager-bg/pacrunner-domains-bgo780558.tar.gz
fixup! pacrunner: rework processing of configuration entriesbg/pacrunner-domains-bgo780558
I think it's more idiomatic this way. config_new() will always take over a reference to @args. If @args happens to be floating, fine. Previously, it was that config_new() would take ownership of @args, but without incrementing the ref-count. It also means, passing a floating variant to config_new() causes issues because config_new() would not ensure that this floating reference belongs to the Config instance... Not a big difference, but better this way.
-rw-r--r--src/nm-pacrunner-manager.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/nm-pacrunner-manager.c b/src/nm-pacrunner-manager.c
index c28afa6a42..88d82602ef 100644
--- a/src/nm-pacrunner-manager.c
+++ b/src/nm-pacrunner-manager.c
@@ -84,7 +84,7 @@ config_new (NMPacrunnerManager *manager, char *tag, GVariant *args)
config = g_slice_new0 (Config);
config->manager = manager;
config->tag = tag;
- config->args = args;
+ config->args = g_variant_ref_sink (args);
config->refcount = 1;
return config;
@@ -258,13 +258,12 @@ static void
pacrunner_send_config (NMPacrunnerManager *self, Config *config)
{
NMPacrunnerManagerPrivate *priv = NM_PACRUNNER_MANAGER_GET_PRIVATE (self);
- gs_free char *args_str = NULL;
if (priv->pacrunner) {
- if (_LOGT_ENABLED ()) {
- args_str = g_variant_print (config->args, FALSE);
- _LOGT ("sending proxy config for '%s': %s", config->tag, args_str);
- }
+ gs_free char *args_str = NULL;
+
+ _LOGT ("sending proxy config for '%s': %s", config->tag,
+ (args_str = g_variant_print (config->args, FALSE)));
config_ref (config);
g_clear_pointer (&config->path, g_free);
@@ -403,7 +402,7 @@ nm_pacrunner_manager_send (NMPacrunnerManager *self,
}
config = config_new (self, g_strdup (tag),
- g_variant_ref_sink (g_variant_new ("(a{sv})", &proxy_data)));
+ g_variant_new ("(a{sv})", &proxy_data));
priv->configs = g_list_append (priv->configs, config);
/* Send if pacrunner is available on bus, otherwise