From: Andrei Rybak <rybak.a.v@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, Git List <git@vger.kernel.org>
Cc: Jeff King <peff@peff.net>
Subject: Re: [PATCH v2] C: use skip-prefix to avoid hardcoded string length
Date: Fri, 31 Jan 2020 21:15:14 +0100 [thread overview]
Message-ID: <CACayv=hcH=dvfup2fzm5-OKYxEyC1m7YBTfpm=6z0BhO=hK-cQ@mail.gmail.com> (raw)
In-Reply-To: <xmqqa764d9f1.fsf_-_@gitster-ct.c.googlers.com>
On 1/30/20 8:35 PM, Junio C Hamano wrote:
> We often skip an optional prefix in a string with a hardcoded
> constant, e.g.
>
> if (starts_with(string, "prefix"))
> string += 6;
>
> which is less error prone when written
>
> skip_prefix(string, "prefix", &string);
Should the subject line say "skip_prefix" with an underscore instead of
"skip-prefix" with a dash?
next prev parent reply other threads:[~2020-01-31 20:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-27 22:21 [PATCH] C: use skip-prefix to avoid hardcoded string length Junio C Hamano
2020-01-27 23:20 ` Jeff King
2020-01-28 0:45 ` Junio C Hamano
2020-01-30 19:35 ` [PATCH v2] " Junio C Hamano
2020-01-31 0:19 ` Jeff King
2020-01-31 20:15 ` Andrei Rybak [this message]
2020-01-31 21:03 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACayv=hcH=dvfup2fzm5-OKYxEyC1m7YBTfpm=6z0BhO=hK-cQ@mail.gmail.com' \
--to=rybak.a.v@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.
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).