[gnome-network-displays/cc-tmp: 77/80] cc: g_autoptr




commit 4baa1511be275884e3a00908594d59774befdcb8
Author: Anupam Kumar <kyteinsky gmail com>
Date:   Tue Sep 6 19:56:09 2022 +0530

    cc: g_autoptr

 src/cc/cc-comm.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/src/cc/cc-comm.c b/src/cc/cc-comm.c
index b93246a..e7f0eea 100644
--- a/src/cc/cc-comm.c
+++ b/src/cc/cc-comm.c
@@ -234,7 +234,7 @@ cc_comm_make_connection (CcComm *comm, gchar *remote_address, GError **error)
   GSocketFamily socket_family;
   GSocketConnectable * connectable;
   GIOStream *tls_conn;
-  GSocketAddressEnumerator * enumerator;
+  g_autoptr(GSocketAddressEnumerator) enumerator = NULL;
 
   /* we must be disconnected */
   g_assert (comm->con == NULL);
@@ -258,7 +258,7 @@ cc_comm_make_connection (CcComm *comm, gchar *remote_address, GError **error)
   enumerator = g_socket_connectable_enumerate (connectable);
   while (TRUE)
     {
-      GSocketAddress * address = g_socket_address_enumerator_next (enumerator, comm->cancellable, error);
+      g_autoptr(GSocketAddress) address = g_socket_address_enumerator_next (enumerator, comm->cancellable, 
error);
       if (address == NULL)
         {
           g_warning ("CcComm: Failed to create address");
@@ -267,10 +267,7 @@ cc_comm_make_connection (CcComm *comm, gchar *remote_address, GError **error)
 
       if (g_socket_connect (socket, address, comm->cancellable, error))
         break;
-
-      g_object_unref (address);
     }
-  g_object_unref (enumerator);
 
   comm->con = G_IO_STREAM (g_socket_connection_factory_create_connection (socket));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]