[Xfce4-commits] <xfce4-sensors-plugin:master> correct support for ACPI names so that we can read the old config with th eold chip name because previously there was random crap in the chip name and the plugin aborted when not finding a suitable name

Fabian noreply at xfce.org
Mon May 14 15:22:01 CEST 2012


Updating branch refs/heads/master
         to 5705d6102045eac546878a27d7655c61fdc7574f (commit)
       from 27aa284a2ce8acf2e94990331bd6818ee119de1b (commit)

commit 5705d6102045eac546878a27d7655c61fdc7574f
Author: Fabian <timystery at arcor.de>
Date:   Mon May 14 15:19:56 2012 +0200

    correct support for ACPI names so that we can read the old config with th eold chip name because previously there was random crap in the chip name and the plugin aborted when not finding a suitable name

 lib/acpi.c |   46 +++++++++++++++++++++++++---------------------
 1 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/lib/acpi.c b/lib/acpi.c
index 979b395..c4c39a3 100644
--- a/lib/acpi.c
+++ b/lib/acpi.c
@@ -44,17 +44,21 @@ strip_key_colon_spaces (char *buf)
     p = buf;
 
     /* Skip everything before the ':' */
-    while (*(p++)) {
-        if (*p == ':') {
-            break;
-        }
+    if (strchr(buf, ':'))
+    {
+      while (*(p++)) {
+          if (*p == ':') {
+              break;
+          }
+      }
+      p++;
     }
-    p++;
     /* Skip all the spaces */
-    while (*(p++)) {
+    while (*p) {
         if (*p != ' ') {
             break;
         }
+        p++;
     }
 
     return p;
@@ -635,28 +639,28 @@ get_acpi_info (void)
     g_free (filename);
 
     if (version!=NULL)
-		{
+    {
         version = g_strchomp (version);
-		}
-		else // if (version==NULL)
-		{
-  	  filename = g_strdup_printf ("%s/%s_", ACPI_PATH, ACPI_INFO);
+    }
+    else // if (version==NULL)
+    {
+      filename = g_strdup_printf ("%s/%s_", ACPI_PATH, ACPI_INFO);
       version = get_acpi_value (filename);
       g_free (filename);
-		
+    
       if (version!=NULL)
         version = g_strchomp (version);
-		
-  		else //if (version==NULL)
-  	
-  		{
-  			version = get_acpi_value ("/sys/module/acpi/parameters/acpica_version");
-  			if (version!=NULL)
+    
+      else //if (version==NULL)
+    
+      {
+        version = get_acpi_value ("/sys/module/acpi/parameters/acpica_version");
+        if (version!=NULL)
           version = g_strchomp (version);
-  		}
-		}
+      }
+    }
   
-		// who knows, if we obtain non-NULL version at all...
+    // who knows, if we obtain non-NULL version at all...
     if (version==NULL) // || g_strisempty(version))
         version = g_strdup(_("<Unknown>"));
 


More information about the Xfce4-commits mailing list