diff options
author | Jeff King <peff@peff.net> | 2009-02-25 03:32:10 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-26 00:49:44 -0800 |
commit | 5483f79998c5a9705d453a713d11fb7591329ed4 (patch) | |
tree | e80ce636a4c7618b184a5749e0dc09f7515cb054 /diff.h | |
parent | 119c8eeede81489b2ce8b26ae7dcb47290e257eb (diff) | |
download | git-5483f79998c5a9705d453a713d11fb7591329ed4.tar.gz git-5483f79998c5a9705d453a713d11fb7591329ed4.tar.xz |
refactor find_ref_by_name() to accept const list
Since it doesn't actually touch its argument, this makes
sense.
However, we still want to return a non-const version (which
requires a cast) so that this:
struct ref *a, *b;
a = find_ref_by_name(b);
works. Unfortunately, you can also silently strip the const
from a variable:
struct ref *a;
const struct ref *b;
a = find_ref_by_name(b);
This is a classic C const problem because there is no way to
say "return the type with the same constness that was passed
to us"; we provide the same semantics as standard library
functions like strchr.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.h')
0 files changed, 0 insertions, 0 deletions