diff options
| author | cnfn <cnfnss@gmail.com> | 2016-12-14 02:32:31 +0800 | 
|---|---|---|
| committer | cnfn <cnfnss@gmail.com> | 2016-12-14 02:32:31 +0800 | 
| commit | f9c0169901b31e82e12ace126753fdd6b1511f39 (patch) | |
| tree | c13c2731bb24bb2b2a9ad70f14066f65fa8d9040 | |
| parent | a5d03ca5ffab3a5ba57f4ff04a7d0dd139c08856 (diff) | |
| download | paramano-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.c | 11 | 
1 files changed, 3 insertions, 8 deletions
@@ -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++;  		}  	}  | 
