command.c: Remove pointless initialization.
authorAndre Noll <maan@systemlinux.org>
Sat, 6 Jul 2013 19:31:11 +0000 (21:31 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 4 Sep 2013 22:23:13 +0000 (22:23 +0000)
Found by the clang analyzer:

command.c:934:16: warning: Assigned value is always the same as the existing value
for (i = 0, p = iov->iov_base; p < end; i++)
    ~ ^ ~~~~~~~~~~~~~

clang is right: A couple of lines before the for loop we set p to
iov->iov_base and do not modify it.

command.c

index 4bbf494c869b6938b596dbf9dcf45b9613fbf924..33cc4b2f647fce152397471bd7c7441fc30e6ff3 100644 (file)
--- a/command.c
+++ b/command.c
@@ -842,7 +842,7 @@ static int parse_sb_command(struct command_context *cc, struct iovec *iov)
        if (ret < 0)
                goto out;
        end = iov->iov_base + iov->iov_len;
        if (ret < 0)
                goto out;
        end = iov->iov_base + iov->iov_len;
-       for (i = 0, p = iov->iov_base; p < end; i++)
+       for (i = 0; p < end; i++)
                p += strlen(p) + 1;
        cc->argc = i;
        cc->argv = para_malloc((cc->argc + 1) * sizeof(char *));
                p += strlen(p) + 1;
        cc->argc = i;
        cc->argv = para_malloc((cc->argc + 1) * sizeof(char *));