summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sha1_file.c b/sha1_file.c
index e1292c1..e2b8e76 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1399,29 +1399,29 @@ void *read_sha1_file_extended(const unsigned char *sha1,
return NULL;
}
-void *read_object_with_reference(const unsigned char *sha1,
+void *read_object_with_reference(const struct object_id *oid,
const char *required_type_name,
unsigned long *size,
- unsigned char *actual_sha1_return)
+ struct object_id *actual_oid_return)
{
enum object_type type, required_type;
void *buffer;
unsigned long isize;
- unsigned char actual_sha1[20];
+ struct object_id actual_oid;
required_type = type_from_string(required_type_name);
- hashcpy(actual_sha1, sha1);
+ oidcpy(&actual_oid, oid);
while (1) {
int ref_length = -1;
const char *ref_type = NULL;
- buffer = read_sha1_file(actual_sha1, &type, &isize);
+ buffer = read_sha1_file(actual_oid.hash, &type, &isize);
if (!buffer)
return NULL;
if (type == required_type) {
*size = isize;
- if (actual_sha1_return)
- hashcpy(actual_sha1_return, actual_sha1);
+ if (actual_oid_return)
+ oidcpy(actual_oid_return, &actual_oid);
return buffer;
}
/* Handle references */
@@ -1435,15 +1435,15 @@ void *read_object_with_reference(const unsigned char *sha1,
}
ref_length = strlen(ref_type);
- if (ref_length + 40 > isize ||
+ if (ref_length + GIT_SHA1_HEXSZ > isize ||
memcmp(buffer, ref_type, ref_length) ||
- get_sha1_hex((char *) buffer + ref_length, actual_sha1)) {
+ get_oid_hex((char *) buffer + ref_length, &actual_oid)) {
free(buffer);
return NULL;
}
free(buffer);
/* Now we have the ID of the referred-to object in
- * actual_sha1. Check again. */
+ * actual_oid. Check again. */
}
}