Re: [PATCH] Remove various dead assignments and dead increments found by the clang static analyzer
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Sep 26, 2009, 20:39 UTC
- Message-ID
- <alpine.DEB.1.00.0909262235010.4985@pacific.mpi-cbg.de>
- In-Reply-To
- <87ske9cya9.fsf@master.homenet>
Hi,
On Sat, 26 Sep 2009, Giuseppe Scrivano wrote:
Show 11 quoted lines
> diff --git a/builtin-commit.c b/builtin-commit.c
> index 200ffda..331d2a0 100644
> --- a/builtin-commit.c
> +++ b/builtin-commit.c
> @@ -1035,7 +1035,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
> parents = reduce_heads(parents);
> } else {
> reflog_msg = "commit";
> - pptr = &commit_list_insert(lookup_commit(head_sha1), pptr)->next;
> + commit_list_insert(lookup_commit(head_sha1), pptr);
> }Sorry, but from the context it seems as if the same remark I had for argc applies here, too. There are exactly three other similar-looking assignments and it is too easy IMO to mess up when one want to rearrange things there.
In other words, I deem the removal of this assignment worse than what we have now -- at least in terms of how easy it is to modify the code safely.
I just looked further 3 hunks and had exactly the same impression there, so I stopped looking.
Sorry, Dscho