summaryrefslogtreecommitdiff
path: root/streaming.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-03-12 02:27:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-14 16:23:50 (GMT)
commitb383a13cc0dbed752b69d7ad249bc857b9d3607b (patch)
treeab9434ad4444be32900ba7fa76211124a9f4a4cd /streaming.c
parentb4f5aca40e6f77cbabcbf4ff003c3cf30a1830c8 (diff)
downloadgit-b383a13cc0dbed752b69d7ad249bc857b9d3607b.zip
git-b383a13cc0dbed752b69d7ad249bc857b9d3607b.tar.gz
git-b383a13cc0dbed752b69d7ad249bc857b9d3607b.tar.bz2
Convert lookup_replace_object to struct object_id
Convert both the argument and the return value to be pointers to struct object_id. Update the callers and their internals to deal with the new type. Remove several temporaries which are no longer needed. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'streaming.c')
-rw-r--r--streaming.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/streaming.c b/streaming.c
index 72a3ca8..46fabee 100644
--- a/streaming.c
+++ b/streaming.c
@@ -105,19 +105,16 @@ ssize_t read_istream(struct git_istream *st, void *buf, size_t sz)
return st->vtbl->read(st, buf, sz);
}
-static enum input_source istream_source(const unsigned char *sha1,
+static enum input_source istream_source(const struct object_id *oid,
enum object_type *type,
struct object_info *oi)
{
unsigned long size;
int status;
- struct object_id oid;
-
- hashcpy(oid.hash, sha1);
oi->typep = type;
oi->sizep = &size;
- status = oid_object_info_extended(&oid, oi, 0);
+ status = oid_object_info_extended(oid, oi, 0);
if (status < 0)
return stream_error;
@@ -140,18 +137,15 @@ struct git_istream *open_istream(const struct object_id *oid,
{
struct git_istream *st;
struct object_info oi = OBJECT_INFO_INIT;
- const unsigned char *real = lookup_replace_object(oid->hash);
+ const struct object_id *real = lookup_replace_object(oid);
enum input_source src = istream_source(real, type, &oi);
- struct object_id realoid;
-
- hashcpy(realoid.hash, real);
if (src < 0)
return NULL;
st = xmalloc(sizeof(*st));
- if (open_istream_tbl[src](st, &oi, &realoid, type)) {
- if (open_istream_incore(st, &oi, &realoid, type)) {
+ if (open_istream_tbl[src](st, &oi, real, type)) {
+ if (open_istream_incore(st, &oi, real, type)) {
free(st);
return NULL;
}