neil / rpms / udisks2

Forked from rpms/udisks2 a year ago
Clone
Tomas Bzatek dd2753
From 0353b5f2f9c586d872750423259b6ef6cc375625 Mon Sep 17 00:00:00 2001
Tomas Bzatek dd2753
From: Tomas Bzatek <tbzatek@redhat.com>
Tomas Bzatek dd2753
Date: Fri, 16 Apr 2021 18:22:46 +0200
Tomas Bzatek dd2753
Subject: [PATCH 6/8] udiskslinuxmdraidobject: Optimize unused data out from
Tomas Bzatek dd2753
 the g_io_channel_read_to_end() call
Tomas Bzatek dd2753
Tomas Bzatek dd2753
Looking into glib sources the g_io_channel_read_to_end() function
Tomas Bzatek dd2753
can handle NULL output pointers just fine and since the data is thrown
Tomas Bzatek dd2753
right away it's pointless to have them assigned.
Tomas Bzatek dd2753
---
Tomas Bzatek dd2753
 src/udiskslinuxmdraidobject.c | 6 +-----
Tomas Bzatek dd2753
 1 file changed, 1 insertion(+), 5 deletions(-)
Tomas Bzatek dd2753
Tomas Bzatek dd2753
diff --git a/src/udiskslinuxmdraidobject.c b/src/udiskslinuxmdraidobject.c
Tomas Bzatek dd2753
index 759ff5f4..20ca89c5 100644
Tomas Bzatek dd2753
--- a/src/udiskslinuxmdraidobject.c
Tomas Bzatek dd2753
+++ b/src/udiskslinuxmdraidobject.c
Tomas Bzatek dd2753
@@ -503,8 +503,6 @@ attr_changed (GIOChannel   *channel,
Tomas Bzatek dd2753
   UDisksLinuxMDRaidObject *object = UDISKS_LINUX_MDRAID_OBJECT (user_data);
Tomas Bzatek dd2753
   gboolean bail = FALSE;
Tomas Bzatek dd2753
   GError *error = NULL;
Tomas Bzatek dd2753
-  gchar *str = NULL;
Tomas Bzatek dd2753
-  gsize len = 0;
Tomas Bzatek dd2753
 
Tomas Bzatek dd2753
   if (cond & ~G_IO_ERR)
Tomas Bzatek dd2753
     goto out;
Tomas Bzatek dd2753
@@ -518,7 +516,7 @@ attr_changed (GIOChannel   *channel,
Tomas Bzatek dd2753
       goto out;
Tomas Bzatek dd2753
     }
Tomas Bzatek dd2753
 
Tomas Bzatek dd2753
-  if (g_io_channel_read_to_end (channel, &str, &len, &error) != G_IO_STATUS_NORMAL)
Tomas Bzatek dd2753
+  if (g_io_channel_read_to_end (channel, NULL, NULL, &error) != G_IO_STATUS_NORMAL)
Tomas Bzatek dd2753
     {
Tomas Bzatek dd2753
       udisks_debug ("Error reading (uuid %s): %s (%s, %d)",
Tomas Bzatek dd2753
                     object->uuid, error->message, g_quark_to_string (error->domain), error->code);
Tomas Bzatek dd2753
@@ -527,8 +525,6 @@ attr_changed (GIOChannel   *channel,
Tomas Bzatek dd2753
       goto out;
Tomas Bzatek dd2753
     }
Tomas Bzatek dd2753
 
Tomas Bzatek dd2753
-  g_free (str);
Tomas Bzatek dd2753
-
Tomas Bzatek dd2753
   /* synthesize uevent */
Tomas Bzatek dd2753
   if (object->raid_device != NULL)
Tomas Bzatek dd2753
     udisks_linux_mdraid_object_uevent (object, "change", object->raid_device, FALSE);
Tomas Bzatek dd2753
-- 
Tomas Bzatek dd2753
2.30.2
Tomas Bzatek dd2753