]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/user-record-show.c
strv: make iterator in STRV_FOREACH() declaread in the loop
[thirdparty/systemd.git] / src / shared / user-record-show.c
index 7c2751f3a7b4619f5f6a80f64af326274df0a8fc..95895a8e458dc2b645dab62c761fcda2f172e3e1 100644 (file)
@@ -143,7 +143,6 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
                         break;
                 }
                 bool has_valid_passwords = false;
-                char **p;
                 STRV_FOREACH(p, hr->hashed_password)
                         if (!hashed_password_is_locked_or_invalid(*p)) {
                                 has_valid_passwords = true;
@@ -240,15 +239,12 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
         if (hr->preferred_language)
                 printf("    Language: %s\n", hr->preferred_language);
 
-        if (!strv_isempty(hr->environment)) {
-                char **i;
-
+        if (!strv_isempty(hr->environment))
                 STRV_FOREACH(i, hr->environment) {
                         printf(i == hr->environment ?
                                " Environment: %s\n" :
                                "              %s\n", *i);
                 }
-        }
 
         if (hr->locked >= 0)
                 printf("      Locked: %s\n", yes_no(hr->locked));
@@ -478,14 +474,11 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
         if (!strv_isempty(hr->ssh_authorized_keys))
                 printf("SSH Pub. Key: %zu\n", strv_length(hr->ssh_authorized_keys));
 
-        if (!strv_isempty(hr->pkcs11_token_uri)) {
-                char **i;
-
+        if (!strv_isempty(hr->pkcs11_token_uri))
                 STRV_FOREACH(i, hr->pkcs11_token_uri)
                         printf(i == hr->pkcs11_token_uri ?
                                "PKCS11 Token: %s\n" :
                                "              %s\n", *i);
-        }
 
         if (hr->n_fido2_hmac_credential > 0)
                 printf(" FIDO2 Token: %zu\n", hr->n_fido2_hmac_credential);
@@ -558,7 +551,6 @@ void group_record_show(GroupRecord *gr, bool show_full_user_info) {
                 }
         } else {
                 const char *prefix = "     Members:";
-                char **i;
 
                 STRV_FOREACH(i, gr->members) {
                         printf("%s %s\n", prefix, *i);
@@ -568,7 +560,6 @@ void group_record_show(GroupRecord *gr, bool show_full_user_info) {
 
         if (!strv_isempty(gr->administrators)) {
                 const char *prefix = "      Admins:";
-                char **i;
 
                 STRV_FOREACH(i, gr->administrators) {
                         printf("%s %s\n", prefix, *i);