add patch remove-useless-code-in-strtohash
[ext4-patch-queue.git] / remove-useless-code-in-strtohash
bloba6f542422664f331867e69839b36d68b3b0d6ddd
1 ext4: remove useless test and assignment in strtohash functions
3 From: Damien Guibouret <damien.guibouret@partition-saving.com>
5 On transformation of str to hash, computed value is initialised before
6 first byte modulo 4. But it is already initialised before entering loop
7 and after processing last byte modulo 4. So the corresponding test and
8 initialisation could be removed.
10 Signed-off-by: Damien Guibouret <damien.guibouret@partition-saving.com>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 ---
13  fs/ext4/hash.c | 4 ----
14  1 file changed, 4 deletions(-)
16 diff --git a/fs/ext4/hash.c b/fs/ext4/hash.c
17 index 38b8a96..00c6dd2 100644
18 --- a/fs/ext4/hash.c
19 +++ b/fs/ext4/hash.c
20 @@ -148,8 +148,6 @@ static void str2hashbuf_signed(const char *msg, int len, __u32 *buf, int num)
21         if (len > num*4)
22                 len = num * 4;
23         for (i = 0; i < len; i++) {
24 -               if ((i % 4) == 0)
25 -                       val = pad;
26                 val = ((int) scp[i]) + (val << 8);
27                 if ((i % 4) == 3) {
28                         *buf++ = val;
29 @@ -176,8 +174,6 @@ static void str2hashbuf_unsigned(const char *msg, int len, __u32 *buf, int num)
30         if (len > num*4)
31                 len = num * 4;
32         for (i = 0; i < len; i++) {
33 -               if ((i % 4) == 0)
34 -                       val = pad;
35                 val = ((int) ucp[i]) + (val << 8);
36                 if ((i % 4) == 3) {
37                         *buf++ = val;