All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: git@vger.kernel.org
Subject: Re: Refactoring hardcoded SHA-1 constants
Date: Fri, 18 Apr 2014 15:40:49 -0700	[thread overview]
Message-ID: <20140418224049.GA15516@google.com> (raw)
In-Reply-To: <20140418221841.GC57656@vauxhall.crustytoothpaste.net>

Hi,

brian m. carlson wrote:

> I'd like to introduce a set of preprocessor constants that we'd use
> instead of hard-coded 20s and 40s everywhere.

Lukewarm on that.  It's hard to do consistently and unless they're
named well it can be harder to know what something like
BINARY_OBJECT_NAME_LENGTH means than plain '20' when first reading.

[...]
> I would also like to consider, as a third step, turning all of the
> unsigned char[20] uses into a struct containing unsigned char[20] as its
> only member, like libgit2 does.

That would be very welcome!

It's a nice way to steer people toward hashcmp using the type system,
and it makes it possible to use a union to enforce alignment later if
measurements show benefit.

Thanks,
Jonathan

  reply	other threads:[~2014-04-18 22:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-18 22:18 Refactoring hardcoded SHA-1 constants brian m. carlson
2014-04-18 22:40 ` Jonathan Nieder [this message]
2014-04-19  0:06   ` Michael Haggerty
2014-04-19  0:48     ` Duy Nguyen
2014-04-19  1:06       ` Junio C Hamano
2014-04-19  1:12         ` Duy Nguyen

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=20140418224049.GA15516@google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sandals@crustytoothpaste.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.