Skip to contentSkip to conversation

fs:ext4:hash.c: reduce one "if" comparison

PATCH Applied Cong Ding 2 participants 2 messages Dec 1, 2012 – Feb 2, 2013 ext4 file system

lore
Share & tools
lore

Cong Ding

author
#0 lore raw

PATCH 1/1 fs:ext4:hash.c: reduce one "if" comparison

it is unnecessary to check i<4 after the loop. just do it before the break.

---
 fs/ext4/hash.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
fs/ext4/hash.c +3 -3
index fa8e491..3d586f0 100644
@@ -155,11 +155,11 @@ int ext4fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo)
 	/* Check to see if the seed is all zero's */
 	if (hinfo->seed) {
 		for (i = 0; i < 4; i++) {
-			if (hinfo->seed[i])
+			if (hinfo->seed[i]) {
+				memcpy(buf, hinfo->seed, sizeof(buf));
 				break;
+			}
 		}
-		if (i < 4)
-			memcpy(buf, hinfo->seed, sizeof(buf));
 	}
 
 	switch (hinfo->hash_version) {
Signature · 1 line
1.7.4.5