grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 06/15] luks2: Rename variable i to keyslot_idx in luks2_ge


From: Patrick Steinhardt
Subject: Re: [PATCH v4 06/15] luks2: Rename variable i to keyslot_idx in luks2_get_keyslot.
Date: Sun, 15 Nov 2020 10:43:55 +0100

On Fri, Nov 06, 2020 at 10:44:26PM -0600, Glenn Washburn wrote:
> Variables named i are usually looping variables, so rename to keyslot_idx to
> allow for easier reading of luks2_get_keyslot.
> 
> Signed-off-by: Glenn Washburn <development@efficientek.com>

Reviewed-by: Patrick Steinhardt <ps@pks.im>

> ---
>  grub-core/disk/luks2.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
> index be42deb14..2830f83cf 100644
> --- a/grub-core/disk/luks2.c
> +++ b/grub-core/disk/luks2.c
> @@ -255,7 +255,7 @@ luks2_parse_digest (grub_luks2_digest_t *out, const 
> grub_json_t *digest)
>  
>  static grub_err_t
>  luks2_get_keyslot (grub_luks2_keyslot_t *k, grub_luks2_digest_t *d, 
> grub_luks2_segment_t *s,
> -                const grub_json_t *root, grub_size_t i)
> +                const grub_json_t *root, grub_size_t keyslot_idx)
>  {
>    grub_json_t keyslots, keyslot, digests, digest, segments, segment;
>    grub_size_t j, size;
> @@ -263,11 +263,11 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k, 
> grub_luks2_digest_t *d, grub_luks2_s
>  
>    /* Get nth keyslot */
>    if (grub_json_getvalue (&keyslots, root, "keyslots") ||
> -      grub_json_getchild (&keyslot, &keyslots, i) ||
> +      grub_json_getchild (&keyslot, &keyslots, keyslot_idx) ||
>        grub_json_getuint64 (&idx, &keyslot, NULL) ||
>        grub_json_getchild (&keyslot, &keyslot, 0) ||
>        luks2_parse_keyslot (k, &keyslot))
> -    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse keyslot 
> %"PRIuGRUB_SIZE, i);
> +    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse keyslot 
> %"PRIuGRUB_SIZE, keyslot_idx);
>  
>    /* Get digest that matches the keyslot. */
>    if (grub_json_getvalue (&digests, root, "digests") ||
> @@ -284,7 +284,7 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k, 
> grub_luks2_digest_t *d, grub_luks2_s
>       break;
>      }
>    if (j == size)
> -      return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No digest for keyslot 
> %"PRIuGRUB_SIZE);
> +      return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No digest for keyslot 
> %"PRIuGRUB_SIZE, keyslot_idx);
>  
>    /* Get segment that matches the digest. */
>    if (grub_json_getvalue (&segments, root, "segments") ||
> -- 
> 2.27.0
> 

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]