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

Re: [PATCH/RFC v1 2/5] add strbuf_set operations documentation

From
Jeremiah Mahler <jmmahler@gmail.com>
Date
Jun 9, 2014, 21:49 UTC
Message-ID
<20140609214958.GA18783@hudson.localdomain>
In-Reply-To
<CAPig+cSB78YZiqWm7oTn3oFXE2yZZFbKmD6R5oHmEJMc9CtwvQ@mail.gmail.com>
Eric,
On Mon, Jun 09, 2014 at 05:53:49AM -0400, Eric Sunshine wrote:
Show 7 quoted lines
> On Mon, Jun 9, 2014 at 4:36 AM, Jeremiah Mahler <jmmahler@gmail.com> wrote:
> > Add documentation of the strbuf_set operations to
> > technical/api-strbuf.txt.
> 
> Since this patch is concise and so closely related to patch 1/5, it
> probably should be squashed into that one.
> 
Fixed.
Show 33 quoted lines
> More below.
> 
> > Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
> > ---
> >  Documentation/technical/api-strbuf.txt | 18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> >
> > diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt
> > index 077a709..ab430d9 100644
> > --- a/Documentation/technical/api-strbuf.txt
> > +++ b/Documentation/technical/api-strbuf.txt
> > @@ -149,6 +149,24 @@ Functions
> >         than zero if the first buffer is found, respectively, to be less than,
> >         to match, or be greater than the second buffer.
> >
> > +* Setting the buffer
> > +
> > +`strbuf_set`::
> > +
> > +    Set the buffer to some data up to a given length.
> 
> I personally find this slightly ambiguous. Upon reading it, the first
> question that pops into my mind is whether or not the existing strbuf
> content is replaced (even though "set" should imply that it is). I
> wonder if it would make sense to rewrite as:
> 
>     Set the buffer to [...], replacing the old content
>     of the buffer.
> 
> Alternately:
> 
>     Replace the buffer content with [...].
> 

On a second reading, I agree that it is ambigous. 'Replace' is much more clear. Great suggestion.

Show 18 quoted lines
> Ditto for the others.
> 
> > +`strbuf_setstr`::
> > +
> > +       Set the buffer to a NUL-terminated string.
> > +
> > +`strbuf_setf`::
> > +
> > +       Set the buffer to a formatted string.
> > +
> > +`strbuf_setbuf`::
> > +
> > +       Set the current buffer to the contents of some other buffer.
> > +
> >  * Adding data to the buffer
> >
> >  NOTE: All of the functions in this section will grow the buffer as necessary.
> > --
-- 
Jeremiah Mahler
jmmahler@gmail.com
http://github.com/jmahler
Previous: Eric SunshineNext: Jeremiah Mahler
Message 5 of 12 in “add strbuf_set operations”
  1. 0/5 add strbuf_set operationsJeremiah Mahler, Jun 9, 2014
  2. 1/5 add strbuf_set operationsJeremiah Mahler, Jun 9, 2014
  3. 2/5 add strbuf_set operations documentationJeremiah Mahler, Jun 9, 2014
  4. Eric SunshineJun 9, 2014
  5. Jeremiah MahlerJun 9, 2014
  6. 3/5 sha1_name.c: cleanup using strbuf_set operationsJeremiah Mahler, Jun 9, 2014
  7. 4/5 fast-import.c: cleanup using strbuf_set operationsJeremiah Mahler, Jun 9, 2014
  8. Eric SunshineJun 9, 2014
  9. Jeremiah MahlerJun 9, 2014
  10. 5/5 builtin/remote.c: cleanup using strbuf_set operationsJeremiah Mahler, Jun 9, 2014
  11. Duy NguyenJun 9, 2014
  12. Jeremiah MahlerJun 9, 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.