normalize code
authorJean-Philippe Orsini <jeanfi@gmail.com>
Fri, 19 Sep 2014 07:14:26 +0000 (09:14 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Fri, 19 Sep 2014 07:14:26 +0000 (09:14 +0200)
src/lib/amd.c
src/lib/amd.h
src/main.c

index 9d0f51f..59a1822 100644 (file)
@@ -280,28 +280,19 @@ void amd_psensor_list_update(struct psensor **sensors)
 }
 
 /* Entry point for AMD sensors */
-struct psensor * *
-amd_psensor_list_add(struct psensor **sensors, int values_len)
+void amd_psensor_list_append(struct psensor ***sensors, int values_len)
 {
        int i, j, n;
-       struct psensor **tmp, **ss, *s;
+       struct psensor *s;
 
        n = init();
 
-       ss = sensors;
        for (i = 0; i < n; i++)
                /* Each GPU Adapter has 3 sensors: temp, fan speed and usage */
                for (j = 0; j < 3; j++) {
                        s = create_sensor(i, j, values_len);
-                       tmp = psensor_list_add(ss, s);
-
-                       if (ss != tmp)
-                               free(ss);
-
-                       ss = tmp;
+                       psensor_list_append(sensors, s);
                }
-
-       return ss;
 }
 
 void amd_cleanup()
index acb234d..d7dde40 100644 (file)
 
 #include "psensor.h"
 
-/*
-  Updates temperatures of AMD sensors.
-*/
 void amd_psensor_list_update(struct psensor **sensors);
 
-/*
-  Adds AMD sensors to a given list of sensors.
-
-  Returns the new allocated list of sensors if sensors have been added
-  otherwise returns 'sensors'. The list is 'NULL' terminated.
- */
-struct psensor **amd_psensor_list_add(struct psensor **sensors,
-                                        int values_max_length);
+void amd_psensor_list_append(struct psensor ***sensors, int values_max_length);
 
 void amd_cleanup();
 
index 22072f6..ba3eafb 100644 (file)
@@ -472,7 +472,7 @@ static struct psensor **create_sensors_list(const char *url,
 #endif
 #ifdef HAVE_LIBATIADL
                if (config_is_atiadlsdk_enabled())
-                       sensors = amd_psensor_list_add(sensors, 600);
+                       amd_psensor_list_append(&sensors, 600);
 #endif
 #ifdef HAVE_GTOP
                if (config_is_gtop2_enabled())