1
0
mirror of https://github.com/git/git.git synced 2025-03-22 11:56:24 +00:00
Jeff King 5545f057d4 fetch-pack: simplify add_sought_entry
We have two variants of this function, one that takes a
string and one that takes a ptr/len combo. But we only call
the latter with the length of a NUL-terminated string, so
our first simplification is to drop it in favor of the
string variant.

Since we know we have a string, we can also replace the
manual memory computation with a call to alloc_ref().

Furthermore, we can rely on get_oid_hex() to complain if it
hits the end of the string. That means we can simplify the
check for "<sha1> <ref>" versus just "<ref>". Rather than
manage the ptr/len pair, we can just bump the start of our
string forward. The original code over-allocated based on
the original "namelen" (which wasn't _wrong_, but was simply
wasteful and confusing).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-02-22 14:51:09 -08:00
..
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-11-20 04:52:01 -05:00
2015-10-21 15:59:34 -07:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-10-05 13:20:08 -07:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00
2015-11-20 08:02:05 -05:00