* [PATCH] fs:ext4:hash.c: reduce one "if" comparison
@ 2012-12-01 23:33 Cong Ding
2013-02-02 3:34 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Cong Ding @ 2012-12-01 23:33 UTC (permalink / raw)
To: Theodore Ts'o, Andreas Dilger, linux-ext4, linux-kernel; +Cc: Cong Ding
it is unnecessary to check i<4 after the loop. just do it before the break.
Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
fs/ext4/hash.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/ext4/hash.c b/fs/ext4/hash.c
index fa8e491..3d586f0 100644
--- a/fs/ext4/hash.c
+++ b/fs/ext4/hash.c
@@ -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) {
--
1.7.4.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs:ext4:hash.c: reduce one "if" comparison
2012-12-01 23:33 [PATCH] fs:ext4:hash.c: reduce one "if" comparison Cong Ding
@ 2013-02-02 3:34 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2013-02-02 3:34 UTC (permalink / raw)
To: Cong Ding; +Cc: Andreas Dilger, linux-ext4, linux-kernel
On Sat, Dec 01, 2012 at 11:33:41PM +0000, Cong Ding wrote:
> it is unnecessary to check i<4 after the loop. just do it before the break.
>
> Signed-off-by: Cong Ding <dinggnu@gmail.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-02 3:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-01 23:33 [PATCH] fs:ext4:hash.c: reduce one "if" comparison Cong Ding
2013-02-02 3:34 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).