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

Re: [PATCH v2 06/11] reftable/stack: reuse buffers when reloading stack

From
Han-Wen Nienhuys <hanwenn@gmail.com>
Date
Dec 21, 2023, 10:58 UTC
Message-ID
<CAOw_e7bvud5M-1+kCi3gRuso3DqC19ujjKx079ORHKWiwC=Zzg@mail.gmail.com>
In-Reply-To
<ZXbRmwj1vZ2dA3s9@tanuki>
On Mon, Dec 11, 2023 at 10:08 AM Patrick Steinhardt <ps@pks.im> wrote:
Show 12 quoted lines
> > This initially caught me by surprise, but on closer inspection I agree
> > that this is OK, since stack_filename() calls strbuf_reset() before
> > adjusting the buffer contents.
> >
> > (As a side-note, I do find the side-effect of stack_filename() to be a
> > little surprising, but that's not the fault of this series and not worth
> > changing here.)
>
> Agreed, I also found this to be a bit confusing at first. I'll amend the
> commit message with "Note that we do not have to manually reset the
> buffer because `stack_filename()` does this for us already." to help
> future readers.

In C++ it is expected that assignment operators clear the destination before executing the assignment, so it depends on your expectations. If this is confusing, maybe another name is in order?

-- 
Han-Wen Nienhuys - hanwenn@gmail.com - http://www.xs4all.nl/~hanwen
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 30 of 58 in “reftable: small set of fixes”
  1. 0/8 reftable: small set of fixesPatrick Steinhardt, Nov 21, 2023
  2. 1/8 reftable: wrap EXPECT macros in do/whilePatrick Steinhardt, Nov 21, 2023
  3. 2/8 reftable: handle interrupted readsPatrick Steinhardt, Nov 21, 2023
  4. 3/8 reftable: handle interrupted writesPatrick Steinhardt, Nov 21, 2023
  5. 4/8 reftable/stack: verify that `reftable_stack_add()` uses auto-compactionPatrick Steinhardt, Nov 21, 2023
  6. 5/8 reftable/stack: perform auto-compaction with transactional interfacePatrick Steinhardt, Nov 21, 2023
  7. Han-Wen NienhuysDec 21, 2023
  8. Patrick SteinhardtDec 21, 2023
  9. 6/8 reftable/stack: reuse buffers when reloading stackPatrick Steinhardt, Nov 21, 2023
  10. 7/8 reftable/merged: reuse buffer to compute record keysPatrick Steinhardt, Nov 21, 2023
  11. Han-Wen NienhuysDec 21, 2023
  12. 8/8 reftable/stack: fix stale lock when dyingPatrick Steinhardt, Nov 21, 2023
  13. 00/11 reftable: small set of fixesPatrick Steinhardt, Dec 8, 2023
  14. 01/11 reftable: wrap EXPECT macros in do/whilePatrick Steinhardt, Dec 8, 2023
  15. 02/11 reftable: handle interrupted readsPatrick Steinhardt, Dec 8, 2023
  16. Taylor BlauDec 8, 2023
  17. Patrick SteinhardtDec 11, 2023
  18. 03/11 reftable: handle interrupted writesPatrick Steinhardt, Dec 8, 2023
  19. 04/11 reftable/stack: verify that `reftable_stack_add()` uses auto-compactionPatrick Steinhardt, Dec 8, 2023
  20. Taylor BlauDec 8, 2023
  21. Eric SunshineDec 8, 2023
  22. Patrick SteinhardtDec 11, 2023
  23. Eric SunshineDec 11, 2023
  24. 05/11 reftable/stack: perform auto-compaction with transactional interfacePatrick Steinhardt, Dec 8, 2023
  25. Taylor BlauDec 8, 2023
  26. Patrick SteinhardtDec 11, 2023
  27. 06/11 reftable/stack: reuse buffers when reloading stackPatrick Steinhardt, Dec 8, 2023
  28. Taylor BlauDec 8, 2023
  29. Patrick SteinhardtDec 11, 2023
  30. Han-Wen NienhuysDec 21, 2023
  31. 07/11 reftable/stack: fix stale lock when dyingPatrick Steinhardt, Dec 8, 2023
  32. Taylor BlauDec 8, 2023
  33. Patrick SteinhardtDec 11, 2023
  34. 08/11 reftable/stack: fix use of unseeded randomnessPatrick Steinhardt, Dec 8, 2023
  35. Han-Wen NienhuysDec 21, 2023
  36. 09/11 reftable/merged: reuse buffer to compute record keysPatrick Steinhardt, Dec 8, 2023
  37. 10/11 reftable/block: introduce macro to initialize `struct block_iter`Patrick Steinhardt, Dec 8, 2023
  38. 11/11 reftable/block: reuse buffer to compute record keysPatrick Steinhardt, Dec 8, 2023
  39. Han-Wen NienhuysDec 21, 2023
  40. Patrick SteinhardtDec 28, 2023
  41. Taylor BlauDec 8, 2023
  42. 00/11 reftable: small set of fixesPatrick Steinhardt, Dec 11, 2023
  43. 01/11 reftable: wrap EXPECT macros in do/whilePatrick Steinhardt, Dec 11, 2023
  44. 02/11 reftable: handle interrupted readsPatrick Steinhardt, Dec 11, 2023
  45. 03/11 reftable: handle interrupted writesPatrick Steinhardt, Dec 11, 2023
  46. 04/11 reftable/stack: verify that `reftable_stack_add()` uses auto-compactionPatrick Steinhardt, Dec 11, 2023
  47. Taylor BlauDec 11, 2023
  48. Patrick SteinhardtDec 12, 2023
  49. 05/11 reftable/stack: perform auto-compaction with transactional interfacePatrick Steinhardt, Dec 11, 2023
  50. 06/11 reftable/stack: reuse buffers when reloading stackPatrick Steinhardt, Dec 11, 2023
  51. 07/11 reftable/stack: fix stale lock when dyingPatrick Steinhardt, Dec 11, 2023
  52. 08/11 reftable/stack: fix use of unseeded randomnessPatrick Steinhardt, Dec 11, 2023
  53. 09/11 reftable/merged: reuse buffer to compute record keysPatrick Steinhardt, Dec 11, 2023
  54. 10/11 reftable/block: introduce macro to initialize `struct block_iter`Patrick Steinhardt, Dec 11, 2023
  55. 11/11 reftable/block: reuse buffer to compute record keysPatrick Steinhardt, Dec 11, 2023
  56. Taylor BlauDec 11, 2023
  57. Patrick SteinhardtDec 12, 2023
  58. Han-Wen NienhuysDec 21, 2023

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.