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

Re: [PATCH 1/5] Introduces for_each_revision() helper

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 28, 2007, 12:52 UTC
Message-ID
<Pine.LNX.4.64.0704281451510.12006@racer.site>
In-Reply-To
<20070428115059.GA4888@steel.home>
Hi,
On Sat, 28 Apr 2007, Alex Riesen wrote:
Show 12 quoted lines
> Johannes Schindelin, Sat, Apr 28, 2007 04:46:41 +0200:
> > > +#define for_each_revision(commit, rev) \
> > > +	for (prepare_revision_walk(rev); \
> > > +		  (commit = get_revision(rev)) != NULL; )
> > > +
> > >  #endif
> > 
> > I object to this, additionally to the magic argument that I agree to, on 
> > the grounds that it is actually wrong. The first iteration will work on an 
> > _uninitialized_ "commit" variable.
> 
> No, it wont. Check it. This code is correct.

Yes, sorry, as I admitted in my reply to Junio, there was some serious mental temporary disability involved.

Show 6 quoted lines
> > Furthermore, it is not like it was a huge piece of code that is being 
> > replaced by a shortcut. There are better places to do some 
> > libification than this.
> 
> It is not about libification. It is plain readability issue. Look at 
> what list_for_each_* macros did to the source of Linux kernel.

Personally, I find the prepare/get_revision stuff not really too unreadable.

Ciao, Dscho

Previous: Alex RiesenNext: Luiz Fernando N. Capitulino
Message 10 of 17 in “New for_each_revision() helper”
  1. 0/5 New for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007
  2. 1/5 Introduces for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007
  3. Junio C HamanoApr 27, 2007
  4. Luiz Fernando N. CapitulinoApr 27, 2007
  5. Junio C HamanoApr 29, 2007
  6. Shawn O. PearceApr 29, 2007
  7. Junio C HamanoApr 30, 2007
  8. Johannes SchindelinApr 28, 2007
  9. Alex RiesenApr 28, 2007
  10. Johannes SchindelinApr 28, 2007
  11. Luiz Fernando N. CapitulinoApr 28, 2007
  12. Alex RiesenApr 28, 2007
  13. Luiz Fernando N. CapitulinoApr 29, 2007
  14. 2/5 builtin-fmt-merge-msg.c: Use for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007
  15. 3/5 reachable.c: Use for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007
  16. 4/5 builtin-shortlog.c: Use for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007
  17. 5/5 builtin-log.c: Use for_each_revision() helperLuiz Fernando N. Capitulino, Apr 27, 2007

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.