git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Han-Wen Nienhuys <hanwen@google.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jeff King <peff@peff.net>
Subject: Re: [PATCH 3/3] strbuf.[ch]: make strbuf_fread() take hint, not size
Date: Wed, 7 Jul 2021 13:47:00 +0200	[thread overview]
Message-ID: <CAFQ2z_MWMokX8hXdOJfiL9Yn=F-QUWe5VHXFEF5DoSBBJu=dmw@mail.gmail.com> (raw)
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

  reply	other threads:[~2021-07-07 11:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 10:38 [PATCH 0/3] strbuf.[ch]: add STRBUF_HINT_SIZE, don't hardcode 8192 Ævar Arnfjörð Bjarmason
2021-07-07 10:38 ` [PATCH 1/3] strbuf.[ch]: add STRBUF_HINT_SIZE macro = 8192 Ævar Arnfjörð Bjarmason
2021-07-07 22:33   ` Junio C Hamano
2021-07-07 10:38 ` [PATCH 2/3] strbuf.h API users: don't hardcode 8192, use STRBUF_HINT_SIZE Ævar Arnfjörð Bjarmason
2021-07-07 20:10   ` Eric Sunshine
2021-07-07 22:37   ` Junio C Hamano
2021-07-07 23:09     ` Junio C Hamano
2021-07-07 23:22     ` Randall S. Becker
2021-07-12 17:58     ` Jeff King
2021-07-07 10:38 ` [PATCH 3/3] strbuf.[ch]: make strbuf_fread() take hint, not size Ævar Arnfjörð Bjarmason
2021-07-07 11:47   ` Han-Wen Nienhuys [this message]
2021-07-07 21:27     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFQ2z_MWMokX8hXdOJfiL9Yn=F-QUWe5VHXFEF5DoSBBJu=dmw@mail.gmail.com' \
    --to=hanwen@google.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).