diff options
author | Jeff King <peff@peff.net> | 2016-02-22 17:44:50 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-22 14:51:09 -0800 |
commit | 5545f057d4684de99feca0ca480297e3d71fb812 (patch) | |
tree | f585d64615a567adc297c4a530f4ace095e9d988 /t/t4034/python/post | |
parent | fast-import: simplify allocation in start_packfile (diff) | |
download | tgif-5545f057d4684de99feca0ca480297e3d71fb812.tar.xz |
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>
Diffstat (limited to 't/t4034/python/post')
0 files changed, 0 insertions, 0 deletions