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

Re: Use more strbufs series [on top of next]

From
Pierre Habouzit <madcoder@debian.org>
Date
Sep 9, 2007, 00:12 UTC
Message-ID
<20070909001205.GD13385@artemis.corp>
In-Reply-To
<11892962763548-git-send-email-madcoder@debian.org>
On Sun, Sep 09, 2007 at 12:04:30AM +0000, Pierre Habouzit wrote:
>   Here is a series of patches on top of next, which use strbufs in even
> more places. Most notably, it uses it in the commit pretty printer (and
> commit message formatter), and it supersedes definitely read_fd
> (previously in sha1_file.c).
  A side note that could help the patch readers: in some places I've
made hunks that basically rename variables called space or size into
len. The reason is that (in my coding standards) length is the length of
the object we are referring to, whereas space/size/... is the amount of
memory we have allocated for it. For a string, the latter is strictly
greater than the former because of the ending NUL of course.
  The rename is because my brain is used to this way of thinking and
that it helps knowing if the off-by-some (off-by-one for a string) are
included in the length-related number you work with or not. So please
don't discard those :)
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Pierre HabouzitNext: Linus Torvalds
Message 8 of 9 in “Use more strbufs series [on top of next]”
  1. Pierre HabouzitSep 9, 2007
  2. 1/6 Add strbuf_rtrim and strbuf_insert.Pierre Habouzit, Sep 9, 2007
  3. 2/6 Change semantics of interpolate to work like snprintf.Pierre Habouzit, Sep 9, 2007
  4. 3/6 Rework pretty_print_commit to use strbufs instead of custom buffers.Pierre Habouzit, Sep 9, 2007
  5. 4/6 Use strbuf_read in builtin-fetch-tool.c.Pierre Habouzit, Sep 9, 2007
  6. 5/6 Use strbufs to in read_message (imap-send.c), custom buffer--.Pierre Habouzit, Sep 9, 2007
  7. 6/6 Replace all read_fd use with strbuf_read, and get rid of it.Pierre Habouzit, Sep 9, 2007
  8. Pierre HabouzitSep 9, 2007
  9. Linus TorvaldsSep 27, 2007

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.