From: Andrew Morton - braces are useful - Dont' open-code ARRAY_SIZE() Cc: Michael Halcrow Signed-off-by: Andrew Morton --- fs/ecryptfs/crypto.c | 17 ++++++----------- 1 files changed, 6 insertions(+), 11 deletions(-) diff -puN fs/ecryptfs/crypto.c~ecryptfs-more-elegant-aes-key-size-manipulation-tidy fs/ecryptfs/crypto.c --- 25/fs/ecryptfs/crypto.c~ecryptfs-more-elegant-aes-key-size-manipulation-tidy Tue Jun 20 17:37:45 2006 +++ 25-akpm/fs/ecryptfs/crypto.c Tue Jun 20 17:37:45 2006 @@ -1049,7 +1049,7 @@ u16 ecryptfs_code_for_cipher_string(stru struct ecryptfs_cipher_code_str_map_elem *map = ecryptfs_cipher_code_str_map; - if (strcmp(crypt_stat->cipher, "aes") == 0) + if (strcmp(crypt_stat->cipher, "aes") == 0) { switch (crypt_stat->key_size) { case 16: code = RFC2440_CIPHER_AES_128; @@ -1060,16 +1060,13 @@ u16 ecryptfs_code_for_cipher_string(stru case 32: code = RFC2440_CIPHER_AES_256; } - else - for (i = 0; i < (sizeof(ecryptfs_cipher_code_str_map) - / sizeof(struct - ecryptfs_cipher_code_str_map_elem)); - i++) - if (strcmp(crypt_stat->cipher, map[i].cipher_str) - == 0) { + } else { + for (i = 0; i < ARRAY_SIZE(ecryptfs_cipher_code_str_map); i++) + if (strcmp(crypt_stat->cipher, map[i].cipher_str) == 0){ code = map[i].cipher_code; break; } + } return code; } @@ -1086,9 +1083,7 @@ int ecryptfs_cipher_code_to_string(char int i; str[0] = '\0'; - for (i = 0; i < (sizeof(ecryptfs_cipher_code_str_map) - / sizeof(struct ecryptfs_cipher_code_str_map_elem)); - i++) + for (i = 0; i < ARRAY_SIZE(ecryptfs_cipher_code_str_map); i++) if (cipher_code == ecryptfs_cipher_code_str_map[i].cipher_code) strcpy(str, ecryptfs_cipher_code_str_map[i].cipher_str); if (str[0] == '\0') { _