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

Re: [RFC 2/3] Alternates API: Improve naming

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 30, 2011, 22:31 UTC
Message-ID
<7vwrjgkzps.fsf@alter.siamese.dyndns.org>
In-Reply-To
<a0e5204fe8c03b3b6af2150198bad51f86b126c4.1301521243.git.mfwitten@gmail.com>
Michael Witten <mfwitten@gmail.com> writes:
Show 16 quoted lines
> diff --git a/sha1_file.c b/sha1_file.c
> index e55a496..a6c1f1f 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -390,11 +390,11 @@ void add_to_alternates_file(const char *reference)
>  
>  void foreach_alt_odb(alt_odb_fn fn)
>  {
> -	struct alternate_object_database *ent;
> +	struct alternate_object_database *d;
>  
>  	prepare_alt_odb();
> -	for (ent = alt_odb_list; ent; ent = ent->next)
> +	for (d = alt_odb_list; d; d = d->next)
> -		if (fn(ent))
> +		if (fn(d))

I see this as a naming regression; that pointer variable points at an entry in a list, and the callback is very well aware of that too (so the s/e/d/g in an earlier hunk also is a naming regression).

Previous: Michael WittenNext: Michael Witten
Message 9 of 12 in “[RFC 1/2] Portability: Convert strictly between function pointers”
  1. Michael WittenMar 29, 2011
  2. 2/2 Future Proofing: Pass around pointers to either functions or dataMichael Witten, Mar 29, 2011
  3. Erik Faye-LundMar 30, 2011
  4. Michael WittenMar 30, 2011
  5. Junio C HamanoMar 30, 2011
  6. 1/3 Alternates API: Untangle the interfaceMichael Witten, Mar 30, 2011
  7. Junio C HamanoMar 30, 2011
  8. 2/3 Alternates API: Improve namingMichael Witten, Mar 30, 2011
  9. Junio C HamanoMar 30, 2011
  10. 3/3 Alternates API: Remove unused parameterMichael Witten, Mar 30, 2011
  11. 0/3 Alternates APIMichael Witten, Mar 30, 2011
  12. Junio C HamanoMar 30, 2011

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.