[Xfce4-commits] [panel-plugins/xfce4-sensors-plugin] 02/06: Remove unnecessary strdup and free when refreshing sensor data

noreply at xfce.org noreply at xfce.org
Wed Apr 26 20:24:51 CEST 2017


This is an automated email from the git hooks/post-receive script.

timystery pushed a commit to branch master
in repository panel-plugins/xfce4-sensors-plugin.

commit 5560489d2d2bca17e5a4b47a5b884a5e314eb1d0
Author: Fabian <timystery at arcor.de>
Date:   Fri Apr 21 21:54:23 2017 +0200

    Remove unnecessary strdup and free when refreshing sensor data
---
 src/actions.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index bd32ade..d7dfacb 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -62,7 +62,7 @@ refresh_sensor_data (t_sensors_dialog *ptr_sensors_dialog_structure)
     t_sensors *ptr_sensors_structure;
     int idx_chip, idx_feature, result;
     double val_sensor_feature;
-    gchar *tmp;
+    gchar *str_formatted_sensor_value;
     t_chipfeature *ptr_chipfeature_structure;
     t_chip *ptr_chip_structure;
 
@@ -94,17 +94,15 @@ refresh_sensor_data (t_sensors_dialog *ptr_sensors_dialog_structure)
                     "value.\nProper proceeding cannot be guaranteed.\n") );
                     break;
                 }
-                tmp = g_new (gchar, 0);
                 format_sensor_value (ptr_sensors_structure->scale, ptr_chipfeature_structure,
-                                     val_sensor_feature, &tmp);
+                                     val_sensor_feature, &str_formatted_sensor_value);
 
                 if (ptr_chipfeature_structure->formatted_value != NULL)
                     g_free (ptr_chipfeature_structure->formatted_value);
 
-                ptr_chipfeature_structure->formatted_value = g_strdup (tmp);
+                ptr_chipfeature_structure->formatted_value = str_formatted_sensor_value;
                 ptr_chipfeature_structure->raw_value = val_sensor_feature;
 
-                g_free (tmp);
             } /* end if ptr_chipfeature_structure->valid */
         }
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list