Re: [PATCH 03/13] revert: Don't check lone argument in get_encoding
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jun 21, 2011, 16:03 UTC
- Message-ID
- <20110621160306.GH15461@elie>
- In-Reply-To
- <1308661489-20080-4-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra wrote:
> The get_encoding function has only one callsite, and its caller makes > sure that a NULL argument isn't passed. Don't unnecessarily double > check the same argument in get_encoding.
Yes, this one's pretty good, though I suspect the actual reason for the patch is not just dead code elimination.
The patch itself gives reason to be comfortable: the "while" loop right after the removed "if" checks the value of *p immediately, so if callers start passing NULL, it will be pretty obvious.
I suspect the actual motivation is to avoid access to the "commit" global, in preparation for making it local. A nice side-benefit is removing a translated message.