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

Re: [PATCH v3 4/4] wt-status.c: Set the committable flag in the collect phase.

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 24, 2018, 21:02 UTC
Message-ID
<xmqqzhw6r4m1.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<2295579.U4Xb9QnJqG@thunderbird>
Stephen Smith <ischis2@cox.net> writes:
Show 12 quoted lines
> I can see three solutions and could support any of the three:
> 1) Move the free calls to run_status() and cmd_status().
> 2) Move the calls calls to wt_status_print since that is the last function 
> from wt_status.c that is called befor the structure goes out of scope in  
> run_status() and cmd_status().
> 3) Add a new wt_collect*() function to free the variables. This would have an 
> advantage that the free calls could be grouped in on place and not done in to 
> functions.  A second advantage is that the free calls would be located where 
> the pointers are initialized.  
>
> Personally I like solutions 1 and 3 over 2.
> What do others think?

I think freeing at the top level caller (i.e. #1) once it finished using the information collected would make the most sense---it initiated the collection, then fed the collected info to shower, and now it knows it is done with the pieces of memory it used to make these two parts communicate with each other.

And for keeping multiple "pieces of memory" as a unit, introducing a helper is a good technique (i.e. #3); but I view that mostly as an implementation detail of #1.

Thanks.
Previous: Stephen SmithNext: Ævar Arnfjörð Bjarmason
Message 22 of 25 in “wt-status.c: commitable flag”
  1. 0/4 wt-status.c: commitable flagStephen P. Smith, Sep 6, 2018
  2. 1/4 Move has_unmerged earlier in the file.Stephen P. Smith, Sep 6, 2018
  3. 3/4 t7501: add test of "commit --dry-run --short"Stephen P. Smith, Sep 6, 2018
  4. 2/4 wt-status: rename commitable to committableStephen P. Smith, Sep 6, 2018
  5. Junio C HamanoSep 7, 2018
  6. 4/4 wt-status.c: Set the committable flag in the collect phase.Stephen P. Smith, Sep 6, 2018
  7. Junio C HamanoSep 7, 2018
  8. Junio C HamanoSep 7, 2018
  9. 0/1 wt-status-state-cleanupStephen P. Smith, Sep 28, 2018
  10. 1/1 roll wt_status_state into wt_status and populate in the collect phaseStephen P. Smith, Sep 28, 2018
  11. Taylor BlauSep 28, 2018
  12. Junio C HamanoSep 28, 2018
  13. 0/1 wt-status-state-cleanupStephen P. Smith, Sep 29, 2018
  14. 1/1 roll wt_status_state into wt_status and populate in the collect phaseStephen P. Smith, Sep 29, 2018
  15. Eric SunshineSep 30, 2018
  16. 0/1 wt-status-state-cleanupStephen P. Smith, Sep 30, 2018
  17. 1/1 roll wt_status_state into wt_status and populate in the collect phaseStephen P. Smith, Sep 30, 2018
  18. Eric SunshineSep 30, 2018
  19. Stephen P. SmithSep 7, 2018
  20. Junio C HamanoSep 11, 2018
  21. Stephen SmithSep 24, 2018
  22. Junio C HamanoSep 24, 2018
  23. Ævar Arnfjörð BjarmasonSep 6, 2018
  24. Stephen & Linda SmithSep 6, 2018
  25. Junio C HamanoSep 7, 2018

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.