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

Re: [PATCH 3/3] strbuf.[ch]: make strbuf_fread() take hint, not size

From
Han-Wen Nienhuys <hanwen@google.com>
Date
Jul 7, 2021, 11:47 UTC
Message-ID
<CAFQ2z_MWMokX8hXdOJfiL9Yn=F-QUWe5VHXFEF5DoSBBJu=dmw@mail.gmail.com>
In-Reply-To
<patch-3.3-46c65a7ae12-20210707T103712Z-avarab@gmail.com>

On Wed, Jul 7, 2021 at 12:39 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

>
> Change the strbuf_fread() function to take a "size_t hint" instead of
> a "size_t size", for consistency with e.g. strbuf_read(). We can then

Making strbuf_fread and strbuf_read consistent is weird because they do different things. strbuf_read reads from fd until it's exhausted, while strbuf_fread reads up to the size specified. So the argument isn't really a hint.

shouldn't you rename it to strbuf_fread_once, analogous to strbuf_read_once ?

bonus points for making the argument ordering consistent between strbuf_fread and strbuf_read

-- 
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
--

Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 11 of 12 in “strbuf.[ch]: add STRBUF_HINT_SIZE, don't hardcode 8192”
  1. 0/3 strbuf.[ch]: add STRBUF_HINT_SIZE, don't hardcode 8192Ævar Arnfjörð Bjarmason, Jul 7, 2021
  2. 1/3 strbuf.[ch]: add STRBUF_HINT_SIZE macro = 8192Ævar Arnfjörð Bjarmason, Jul 7, 2021
  3. Junio C HamanoJul 7, 2021
  4. 2/3 strbuf.h API users: don't hardcode 8192, use STRBUF_HINT_SIZEÆvar Arnfjörð Bjarmason, Jul 7, 2021
  5. Eric SunshineJul 7, 2021
  6. Junio C HamanoJul 7, 2021
  7. Junio C HamanoJul 7, 2021
  8. Randall S. BeckerJul 7, 2021
  9. Jeff KingJul 12, 2021
  10. 3/3 strbuf.[ch]: make strbuf_fread() take hint, not sizeÆvar Arnfjörð Bjarmason, Jul 7, 2021
  11. Han-Wen NienhuysJul 7, 2021
  12. Junio C HamanoJul 7, 2021

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.