git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Christian Couder <christian.couder@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] strbuf: add strbuf_tolower function
Date: Thu, 22 May 2014 09:42:54 -0400	[thread overview]
Message-ID: <20140522134253.GA16408@sigill.intra.peff.net> (raw)
In-Reply-To: <CAP8UFD0PkA_VokFpRkdaKE2UW1AtL6mCY2bOSxOCqX_C9wB=OQ@mail.gmail.com>

[re-adding list cc]

On Thu, May 22, 2014 at 03:16:45PM +0200, Christian Couder wrote:

> > +void strbuf_tolower(struct strbuf *sb)
> > +{
> > +       char *p;
> > +       for (p = sb->buf; *p; p++)
> > +               *p = tolower(*p);
> > +}
> 
> Last time I tried a change like the above, I was told that strbufs are
> buffers that can contain NUL bytes. So maybe it should be:
> 
>        for (p = sb->buf; p < sb->buf + sb->len; p++)
>               *p = tolower(*p);

Hah. I wrote it like that originally, and in review was asked to switch
it. I agree that it might be worth keeping strbuf functions 8bit-clean.
The original intent of the strbuf code was to make C strings easier to
use, but I think we sometimes use them as general buffers, too.

-Peff

  parent reply	other threads:[~2014-05-22 13:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22  9:43 [PATCH 0/2] tolower cleanups Jeff King
2014-05-22  9:44 ` [PATCH 1/2] daemon/config: factor out duplicate xstrdup_tolower Jeff King
2014-05-22  9:44 ` [PATCH 2/2] strbuf: add strbuf_tolower function Jeff King
     [not found]   ` <CAP8UFD0PkA_VokFpRkdaKE2UW1AtL6mCY2bOSxOCqX_C9wB=OQ@mail.gmail.com>
2014-05-22 13:42     ` Jeff King [this message]
2014-05-22 23:17       ` Kyle J. McKay

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

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

  git send-email \
    --in-reply-to=20140522134253.GA16408@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).