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

Re: [PATCH 01/10] name-rev: rewrite create_or_update_name()

From
Taylor Blau <me@ttaylorr.com>
Date
Feb 5, 2020, 02:35 UTC
Message-ID
<20200205023506.GA58070@syl.local>
In-Reply-To
<f0e0ab6c-afde-307e-bbf0-823c576d67ca@gmail.com>
On Tue, Feb 04, 2020 at 09:00:23PM -0500, Derrick Stolee wrote:
Show 10 quoted lines
> On 2/4/2020 4:14 PM, René Scharfe wrote:
> > This code was moved straight out of name_rev(). As such, we inherited
> > the "goto" to jump from an if into an else-if. We also inherited the
> > fact that "nothing to do -- return NULL" is handled last.
> >
> > Rewrite the function to first handle the "nothing to do" case. Then we
> > can handle the conditional allocation early before going on to populate
> > the struct. No need for goto-ing.
>
> I read this carefully and agree it is functionally equivalent.

As did I. I originally thought that my MUA was wrapping the 'else if' line oddly, but then I discovered that it's the label's indentation that was throwing me off.

In any case, this makes good sense. Well done indeed.
Show 5 quoted lines
> Since you are removing a goto and rearranging if/else blocks, I thought
> this response needed to be explicit, at least more than usual. Good work.
>
> Thanks,
> -Stolee

Thanks, Taylor

Previous: Derrick StoleeNext: Andrei Rybak
Message 4 of 27 in “name-rev: improve memory usage”
  1. 00/10 name-rev: improve memory usageRené Scharfe, Feb 4, 2020
  2. 01/10 name-rev: rewrite create_or_update_name()René Scharfe, Feb 4, 2020
  3. Derrick StoleeFeb 5, 2020
  4. Taylor BlauFeb 5, 2020
  5. Andrei RybakFeb 5, 2020
  6. René ScharfeFeb 5, 2020
  7. 02/10 name-rev: remove unused typedefRené Scharfe, Feb 4, 2020
  8. 03/10 name-rev: respect const qualifierRené Scharfe, Feb 4, 2020
  9. 04/10 name-rev: don't leak path copy in name_ref()René Scharfe, Feb 4, 2020
  10. Derrick StoleeFeb 5, 2020
  11. 05/10 name-rev: don't _peek() in create_or_update_name()René Scharfe, Feb 4, 2020
  12. 06/10 name-rev: put struct rev_name into commit slabRené Scharfe, Feb 4, 2020
  13. 07/10 name-rev: factor out get_parent_name()René Scharfe, Feb 4, 2020
  14. 08/10 name-rev: pre-size buffer in get_parent_name()René Scharfe, Feb 4, 2020
  15. Derrick StoleeFeb 5, 2020
  16. René ScharfeFeb 5, 2020
  17. 09/10 name-rev: generate name strings only if they are betterRené Scharfe, Feb 4, 2020
  18. Derrick StoleeFeb 5, 2020
  19. René ScharfeFeb 5, 2020
  20. 10/10 name-rev: release unused name stringsRené Scharfe, Feb 4, 2020
  21. Derrick StoleeFeb 5, 2020
  22. Derrick StoleeFeb 5, 2020
  23. Derrick StoleeFeb 5, 2020
  24. 01/10 name-rev: rewrite create_or_update_name()René Scharfe, Feb 5, 2020
  25. 11/10 name-rev: sort tip names before applyingRené Scharfe, Feb 5, 2020
  26. Junio C HamanoFeb 5, 2020
  27. René ScharfeFeb 5, 2020

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.