From: Glenn Washburn Date: Sat, 7 Nov 2020 04:44:26 +0000 (-0600) Subject: luks2: Rename variable "i" to "keyslot_idx" in luks2_get_keyslot() X-Git-Tag: grub-2.06-rc1~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f36193ddf1d8a29e54d6b7d2a12ce87301038afd;p=thirdparty%2Fgrub.git luks2: Rename variable "i" to "keyslot_idx" in luks2_get_keyslot() Variables named "i" are usually looping variables. So, rename it to "keyslot_idx" to ease luks2_get_keyslot() reading. Signed-off-by: Glenn Washburn Reviewed-by: Patrick Steinhardt Reviewed-by: Daniel Kiper --- 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") ||