aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/temperature/e_mod_main.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2014-04-04 14:51:21 -0400
committerMike Blumenkrantz <zmike@samsung.com>2014-04-04 15:04:28 -0400
commitee3370d226ff5731b09f72fedef19e2c502b3a9b (patch)
treec9dcd4b73c236ada097cef934ce0253c1e94b12a /src/modules/temperature/e_mod_main.c
parentbugfix: check notification icon size correctly (diff)
downloadenlightenment-ee3370d226ff5731b09f72fedef19e2c502b3a9b.tar.gz
bugfix: unify temp module temperature_get_bus_files() functions
CID 1039874
Diffstat (limited to 'src/modules/temperature/e_mod_main.c')
-rw-r--r--src/modules/temperature/e_mod_main.c68
1 files changed, 32 insertions, 36 deletions
diff --git a/src/modules/temperature/e_mod_main.c b/src/modules/temperature/e_mod_main.c
index a309b2cd5..170d723a2 100644
--- a/src/modules/temperature/e_mod_main.c
+++ b/src/modules/temperature/e_mod_main.c
@@ -363,48 +363,44 @@ temperature_face_update_config(Config_Face *inst)
}
Eina_List *
-temperature_get_bus_files(const char* bus)
+temperature_get_bus_files(const char *bus)
{
- Eina_List *result, *therms;
+ Eina_List *result;
+ Eina_List *therms;
char path[PATH_MAX];
char busdir[PATH_MAX];
+ char *name;
result = NULL;
- if (result)
+
+ snprintf(busdir, sizeof(busdir), "/sys/bus/%s/devices", bus);
+ /* Look through all the devices for the given bus. */
+ therms = ecore_file_ls(busdir);
+
+ EINA_LIST_FREE(therms, name)
{
- snprintf(busdir, sizeof(busdir), "/sys/bus/%s/devices", bus);
- /* Look through all the devices for the given bus. */
- therms = ecore_file_ls(busdir);
- if (therms)
- {
- char *name;
-
- EINA_LIST_FREE(therms, name)
- {
- Eina_List *files;
- char *file;
-
- /* Search each device for temp*_input, these should be
- * temperature devices. */
- snprintf(path, sizeof(path), "%s/%s", busdir, name);
- files = ecore_file_ls(path);
- EINA_LIST_FREE(files, file)
- {
- if ((!strncmp("temp", file, 4)) &&
- (!strcmp("_input", &file[strlen(file) - 6])))
- {
- char *f;
-
- snprintf(path, sizeof(path),
- "%s/%s/%s", busdir, name, file);
- f = strdup(path);
- if (f) result = eina_list_append(result, f);
- }
- free(file);
- }
- free(name);
- }
- }
+ Eina_List *files;
+ char *file;
+
+ /* Search each device for temp*_input, these should be
+ * temperature devices. */
+ snprintf(path, sizeof(path), "%s/%s", busdir, name);
+ files = ecore_file_ls(path);
+ EINA_LIST_FREE(files, file)
+ {
+ if ((!strncmp("temp", file, 4)) &&
+ (!strcmp("_input", &file[strlen(file) - 6])))
+ {
+ char *f;
+
+ snprintf(path, sizeof(path),
+ "%s/%s/%s", busdir, name, file);
+ f = strdup(path);
+ if (f) result = eina_list_append(result, f);
+ }
+ free(file);
+ }
+ free(name);
}
return result;
}