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

Re: [PATCH] refs: write packed_refs file using stdio

From
Jeff King <peff@peff.net>
Date
Sep 10, 2014, 19:14 UTC
Message-ID
<20140910191453.GB23655@peff.net>
In-Reply-To
<CAL=YDW=uWP2kWB31MEvJvVP7yUdwoh95PvfEYT6LT1x2UXpAvg@mail.gmail.com>
On Wed, Sep 10, 2014 at 07:32:17AM -0700, Ronnie Sahlberg wrote:
> Even better could be to build an iovec for all the data and use writev() ?
> (now without gmail adding formatting)

I'm not sure that would make anything easier. We're literally sprintf-ing (and calling sha1_to_hex) into a buffer so we can write() it. That seems like a solid case for using fprintf instead.

We can't just writev() a bunch of buffers we have already. We'd literally have to make an array of buffers to format into. It's much simpler (and probably faster) to just format directly into stdio's buffers.

-Peff
Previous: Jeff King
Message 4 of 4 in “refs: write packed_refs file using stdio”
  1. refs: write packed_refs file using stdioJeff King, Sep 10, 2014
  2. Michael HaggertySep 10, 2014
  3. Jeff KingSep 10, 2014
  4. Jeff KingSep 10, 2014

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.