mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gdbusconnection: Factor out signal_data_new_take()
No functional changes, except that the implicit ownership-transfer for the rule field becomes explicit (the local variable is set to NULL afterwards). Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
8dfea5609e
commit
816da60571
@ -336,6 +336,30 @@ typedef struct
|
||||
GPtrArray *subscribers; /* (owned) (element-type SignalSubscriber) */
|
||||
} SignalData;
|
||||
|
||||
static SignalData *
|
||||
signal_data_new_take (gchar *rule,
|
||||
gchar *sender,
|
||||
gchar *sender_unique_name,
|
||||
gchar *interface_name,
|
||||
gchar *member,
|
||||
gchar *object_path,
|
||||
gchar *arg0,
|
||||
GDBusSignalFlags flags)
|
||||
{
|
||||
SignalData *signal_data = g_new0 (SignalData, 1);
|
||||
|
||||
signal_data->rule = rule;
|
||||
signal_data->sender = sender;
|
||||
signal_data->sender_unique_name = sender_unique_name;
|
||||
signal_data->interface_name = interface_name;
|
||||
signal_data->member = member;
|
||||
signal_data->object_path = object_path;
|
||||
signal_data->arg0 = arg0;
|
||||
signal_data->flags = flags;
|
||||
signal_data->subscribers = g_ptr_array_new_with_free_func ((GDestroyNotify) signal_subscriber_unref);
|
||||
return g_steal_pointer (&signal_data);
|
||||
}
|
||||
|
||||
static void
|
||||
signal_data_free (SignalData *signal_data)
|
||||
{
|
||||
@ -3578,16 +3602,14 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
|
||||
goto out;
|
||||
}
|
||||
|
||||
signal_data = g_new0 (SignalData, 1);
|
||||
signal_data->rule = rule;
|
||||
signal_data->sender = g_strdup (sender);
|
||||
signal_data->sender_unique_name = g_strdup (sender_unique_name);
|
||||
signal_data->interface_name = g_strdup (interface_name);
|
||||
signal_data->member = g_strdup (member);
|
||||
signal_data->object_path = g_strdup (object_path);
|
||||
signal_data->arg0 = g_strdup (arg0);
|
||||
signal_data->flags = flags;
|
||||
signal_data->subscribers = g_ptr_array_new_with_free_func ((GDestroyNotify) signal_subscriber_unref);
|
||||
signal_data = signal_data_new_take (g_steal_pointer (&rule),
|
||||
g_strdup (sender),
|
||||
g_strdup (sender_unique_name),
|
||||
g_strdup (interface_name),
|
||||
g_strdup (member),
|
||||
g_strdup (object_path),
|
||||
g_strdup (arg0),
|
||||
flags);
|
||||
g_ptr_array_add (signal_data->subscribers, subscriber);
|
||||
|
||||
g_hash_table_insert (connection->map_rule_to_signal_data,
|
||||
|
Loading…
Reference in New Issue
Block a user