Apply 4 suggestion(s) to 2 file(s)

This commit is contained in:
Philip Withnall 2025-02-19 23:39:58 +00:00
parent 534f3462a2
commit 4457d06139
2 changed files with 11 additions and 10 deletions

View File

@ -606,20 +606,21 @@ void g_dbus_connection_signal_unsubscribe (GDBusConnection
/** /**
* g_clear_dbus_signal_subscription: (skip) * g_clear_dbus_signal_subscription: (skip)
* @subscription_id_pointer: (not optional) (inout): A pointer to either a * @subscription_id_pointer: (not optional) (inout): A pointer to either a
* subscription id obtained from g_dbus_connection_signal_subscribe(), * subscription ID obtained from [method@Gio.DBusConnection.signal_subscribe],
* or zero. * or zero.
* @connection: The connection from which the subscription ID was obtained. * @connection: The connection from which the subscription ID was obtained.
* This pointer may be %NULL or invalid, if the subscription ID is zero. * This pointer may be `NULL` or invalid, if the subscription ID is zero.
* *
* If @subscription_id_pointer points to a nonzero subscription ID, * If @subscription_id_pointer points to a nonzero subscription ID,
* unsubscribe from that D-Bus signal subscription as if via * unsubscribe from that D-Bus signal subscription as if via
* g_dbus_connection_signal_unsubscribe(). * [method@Gio.DBusConnection.signal_unsubscribe].
*
* Also set the value pointed to by @subscription_id_pointer to zero, * Also set the value pointed to by @subscription_id_pointer to zero,
* which is not a valid subscription ID. * which signifies its no longer a valid subscription ID.
* *
* This convenience function for C code helps to ensure that each signal * This convenience function for C code helps to ensure that each signal
* subscription is unsubscribed exactly once, similar to g_clear_object() * subscription is unsubscribed exactly once, similar to
* and g_clear_signal_handler(). * [func@GObject.g_clear_object] and [func@GObject.clear_signal_handler].
* *
* Since: 2.84 * Since: 2.84
*/ */

View File

@ -793,12 +793,12 @@ test_connection_signals (void)
g_assert_cmpint (count_s4, ==, 2); g_assert_cmpint (count_s4, ==, 2);
g_assert_cmpint (count_s5, ==, 1); g_assert_cmpint (count_s5, ==, 1);
g_assert_cmpint (s1, !=, 0); g_assert_cmpuint (s1, !=, 0);
g_clear_dbus_signal_subscription (&s1, c1); g_clear_dbus_signal_subscription (&s1, c1);
g_assert_cmpint (s1, ==, 0); g_assert_cmpuint (s1, ==, 0);
/* g_clear_dbus_signal_subscription() is idempotent, with no warnings */ /* g_clear_dbus_signal_subscription() is idempotent, with no warnings */
g_clear_dbus_signal_subscription (&s1, c1); g_clear_dbus_signal_subscription (&s1, c1);
g_assert_cmpint (s1, ==, 0); g_assert_cmpuint (s1, ==, 0);
g_clear_dbus_signal_subscription (&s2, c1); g_clear_dbus_signal_subscription (&s2, c1);
g_clear_dbus_signal_subscription (&s3, c1); g_clear_dbus_signal_subscription (&s3, c1);