locale: inline iterator variable declarations
This commit is contained in:
@@ -66,9 +66,7 @@ static void context_free_vconsole(Context *c) {
|
||||
}
|
||||
|
||||
static void context_free_locale(Context *c) {
|
||||
int p;
|
||||
|
||||
for (p = 0; p < _VARIABLE_LC_MAX; p++)
|
||||
for (LocaleVariable p = 0; p < _VARIABLE_LC_MAX; p++)
|
||||
c->locale[p] = mfree(c->locale[p]);
|
||||
}
|
||||
|
||||
@@ -85,9 +83,7 @@ void context_clear(Context *c) {
|
||||
};
|
||||
|
||||
void locale_simplify(char *locale[_VARIABLE_LC_MAX]) {
|
||||
int p;
|
||||
|
||||
for (p = VARIABLE_LANG+1; p < _VARIABLE_LC_MAX; p++)
|
||||
for (LocaleVariable p = VARIABLE_LANG+1; p < _VARIABLE_LC_MAX; p++)
|
||||
if (isempty(locale[p]) || streq_ptr(locale[VARIABLE_LANG], locale[p]))
|
||||
locale[p] = mfree(locale[p]);
|
||||
}
|
||||
@@ -138,13 +134,11 @@ int locale_read_data(Context *c, sd_bus_message *m) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else {
|
||||
int p;
|
||||
|
||||
c->locale_mtime = USEC_INFINITY;
|
||||
context_free_locale(c);
|
||||
|
||||
/* Fill in what we got passed from systemd. */
|
||||
for (p = 0; p < _VARIABLE_LC_MAX; p++) {
|
||||
for (LocaleVariable p = 0; p < _VARIABLE_LC_MAX; p++) {
|
||||
const char *name;
|
||||
|
||||
name = locale_variable_to_string(p);
|
||||
@@ -294,11 +288,11 @@ int x11_read_data(Context *c, sd_bus_message *m) {
|
||||
int locale_write_data(Context *c, char ***settings) {
|
||||
_cleanup_strv_free_ char **l = NULL;
|
||||
struct stat st;
|
||||
int r, p;
|
||||
int r;
|
||||
|
||||
/* Set values will be returned as strv in *settings on success. */
|
||||
|
||||
for (p = 0; p < _VARIABLE_LC_MAX; p++) {
|
||||
for (LocaleVariable p = 0; p < _VARIABLE_LC_MAX; p++) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
char **u;
|
||||
const char *name;
|
||||
|
||||
@@ -55,7 +55,6 @@ static void status_info_clear(StatusInfo *info) {
|
||||
static void print_overridden_variables(void) {
|
||||
_cleanup_(locale_variables_freep) char *variables[_VARIABLE_LC_MAX] = {};
|
||||
bool print_warning = true;
|
||||
LocaleVariable j;
|
||||
int r;
|
||||
|
||||
if (arg_transport != BUS_TRANSPORT_LOCAL)
|
||||
@@ -82,7 +81,7 @@ static void print_overridden_variables(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (j = 0; j < _VARIABLE_LC_MAX; j++)
|
||||
for (LocaleVariable j = 0; j < _VARIABLE_LC_MAX; j++)
|
||||
if (variables[j]) {
|
||||
if (print_warning) {
|
||||
log_warning("Warning: Settings on kernel command line override system locale settings in /etc/locale.conf.\n"
|
||||
|
||||
@@ -37,8 +37,7 @@ static int locale_update_system_manager(Context *c, sd_bus *bus) {
|
||||
_cleanup_strv_free_ char **l_set = NULL;
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
size_t c_set, c_unset;
|
||||
LocaleVariable p;
|
||||
size_t c_set = 0, c_unset = 0;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@@ -51,7 +50,7 @@ static int locale_update_system_manager(Context *c, sd_bus *bus) {
|
||||
if (!l_set)
|
||||
return log_oom();
|
||||
|
||||
for (p = 0, c_set = 0, c_unset = 0; p < _VARIABLE_LC_MAX; p++) {
|
||||
for (LocaleVariable p = 0; p < _VARIABLE_LC_MAX; p++) {
|
||||
const char *name;
|
||||
|
||||
name = locale_variable_to_string(p);
|
||||
@@ -178,7 +177,7 @@ static int property_get_locale(
|
||||
|
||||
Context *c = userdata;
|
||||
_cleanup_strv_free_ char **l = NULL;
|
||||
int p, q, r;
|
||||
int r;
|
||||
|
||||
r = locale_read_data(c, reply);
|
||||
if (r < 0)
|
||||
@@ -188,7 +187,7 @@ static int property_get_locale(
|
||||
if (!l)
|
||||
return -ENOMEM;
|
||||
|
||||
for (p = 0, q = 0; p < _VARIABLE_LC_MAX; p++) {
|
||||
for (LocaleVariable p = 0, q = 0; p < _VARIABLE_LC_MAX; p++) {
|
||||
char *t;
|
||||
const char *name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user