Re: [PATCH v2] Rewrite fsck.c:fsck_commit() replace memcmp() with starts_with()
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Mar 21, 2014, 19:01 UTC
- Message-ID
- <vpqk3bngyuy.fsf@anie.imag.fr>
- In-Reply-To
- <1395419838-25527-1-git-send-email-cengoguzhanunlu@gmail.com>
blacksimit <cengoguzhanunlu@gmail.com> writes:
Show 5 quoted lines
> -
> + int magic_num;
> +
> + magic_num = strlen("tree "); /* magic_num is 5 */
> if (!starts_with(buffer, "tree "))Whitespace damage. It seems you have set your tab-width to something other than 8, and indented with spaces. Please don't do either.
> + magic_num = strlen("committer"); /* magic_num is 7 */Typical example of a counter-productive comment. A good comment usually explains _why_ the code is as it is, and not _what_ it is doing. C is a much better lanuage than english to describe algorithm, so if you want magic_num to become equal to 7, then write "magic_num = 7" in code, not in a comment.
Here, the reader has to spend time and energy to check the correspondance between the code and the redundant comment ... and see than they do not match!
-- Matthieu Moy http://www-verimag.imag.fr/~moy/