localectl: count locale variables from 0, instead of VARIABLE_LANG

That way the we make our code safe regarding reordering of the variables
in the enum.
This commit is contained in:
Lennart Poettering
2014-10-02 14:34:55 +02:00
parent 581fe6c817
commit 63229aa1ab

View File

@@ -114,7 +114,7 @@ static void print_overriden_variables(void) {
goto finish;
}
for (j = VARIABLE_LANG; j < _VARIABLE_LC_MAX; j++)
for (j = 0; j < _VARIABLE_LC_MAX; j++)
if (variables[j]) {
if (print_warning) {
printf("Warning: Settings on Kernel Command Line override system locale settings in /etc/locale.conf\n");
@@ -126,7 +126,7 @@ static void print_overriden_variables(void) {
printf(" %s=%s\n", locale_variable_to_string(j), variables[j]);
}
finish:
for (j = VARIABLE_LANG; j < _VARIABLE_LC_MAX; j++)
for (j = 0; j < _VARIABLE_LC_MAX; j++)
free(variables[j]);
}