git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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/
Previous: Junio C HamanoNext: Eric Sunshine
Message 3 of 4 in “Rewrite fsck.c:fsck_commit() replace memcmp() with starts_with()”
  1. Rewrite fsck.c:fsck_commit() replace memcmp() with starts_with()blacksimit, Mar 21, 2014
  2. Junio C HamanoMar 21, 2014
  3. Matthieu MoyMar 21, 2014
  4. Eric SunshineMar 21, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.