aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcnfn <cnfnss@gmail.com>2016-12-14 02:32:31 +0800
committercnfn <cnfnss@gmail.com>2016-12-14 02:32:31 +0800
commitf9c0169901b31e82e12ace126753fdd6b1511f39 (patch)
treec13c2731bb24bb2b2a9ad70f14066f65fa8d9040
parenta5d03ca5ffab3a5ba57f4ff04a7d0dd139c08856 (diff)
downloadparamano-f9c0169901b31e82e12ace126753fdd6b1511f39.tar.xz
fix: cannot get all governors because the file of scaling_available_governors has a n in the line end
-rw-r--r--getgov.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/getgov.c b/getgov.c
index 462b188..01bedb4 100644
--- a/getgov.c
+++ b/getgov.c
@@ -24,15 +24,10 @@ void gg_init()
memset(gov_string, '\0', sizeof(gov_string) );
gg_available(i, gov_string, sizeof(gov_string) );
- char* curr = gov_string;
- char* end_of_curr = g_strstr_len(curr, strlen(curr), " ");
- while (end_of_curr)
- {
+ char** list = g_strsplit(g_strstrip(gov_string), " ", -1);
+ for (char** name = list; *name; ++name) {
memset(governors[i][total_governors], '\0', 13); /* FIXME magic */
- memmove(governors[i][total_governors], curr, end_of_curr - curr);
-
- curr = end_of_curr+1;
- end_of_curr = g_strstr_len(curr, strlen(curr), " ");
+ memmove(governors[i][total_governors], *name, strlen(*name));
total_governors++;
}
}