From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: git@vger•kernel.org,
Johannes Schindelin <johannes.schindelin@gmx•de>,
Karthik Nayak <karthik.188@gmail•com>
Subject: Re: [PATCH] type_from_string_gently: make sure length matches
Date: Fri, 17 Apr 2015 14:11:33 -0700 [thread overview]
Message-ID: <xmqqzj66o3y2.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150417210713.GA7403@peff.net> (Jeff King's message of "Fri, 17 Apr 2015 17:07:13 -0400")
Jeff King <peff@peff•net> writes:
> I'd be surprised if it appreciably speeds things up, but I guess it is
> not too complicated to do.
>
>> +static struct {
>> + const char *str;
>> + int len;
>> +} object_type_name[] = {
>> + { NULL, 0 }, /* OBJ_NONE = 0 */
>> + { "commit", 6 }, /* OBJ_COMMIT = 1 */
>> + { "tree", 4 }, /* OBJ_TREE = 2 */
>> + { "blob", 4 }, /* OBJ_BLOB = 3 */
>> + { "tag", 3 }, /* OBJ_TAG = 4 */
>> };
>
> I had envisioned a macro like:
>
> #define SIZED_STRING(x) { (x), (sizeof(x) - 1) }
>
> though perhaps that is overkill for such a short list (that we don't
> even expect to change).
Sounds good (either way ;-)
prev parent reply other threads:[~2015-04-17 21:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 14:52 [PATCH] type_from_string_gently: make sure length matches Jeff King
2015-04-17 20:54 ` Junio C Hamano
2015-04-17 21:07 ` Jeff King
2015-04-17 21:11 ` Junio C Hamano [this message]
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=xmqqzj66o3y2.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=johannes.schindelin@gmx$(echo .)de \
--cc=karthik.188@gmail$(echo .)com \
--cc=peff@peff$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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