chiark / gitweb /
localectl: count locale variables from 0, instead of VARIABLE_LANG
authorLennart Poettering <lennart@poettering.net>
Thu, 2 Oct 2014 12:34:55 +0000 (14:34 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 2 Oct 2014 12:39:07 +0000 (14:39 +0200)
That way the we make our code safe regarding reordering of the variables
in the enum.

src/locale/localectl.c

index 5917364d7c308b666337095c271f6423aaead560..9325d9af6d1716aab3d892fc5dbf390cee19ea0e 100644 (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]);
 }