Convert object iteration callbacks to struct object_id
[gitweb.git] / sha1_file.c
index 777b8e8eae8e65070ae7ec0063788ec18cd23781..6b74c7d3bce8f8c7099f14dfc7ce3366e7017f6d 100644 (file)
@@ -3685,15 +3685,15 @@ static int for_each_file_in_obj_subdir(int subdir_nr,
                strbuf_setlen(path, baselen);
                strbuf_addf(path, "/%s", de->d_name);
 
-               if (strlen(de->d_name) == 38)  {
-                       char hex[41];
-                       unsigned char sha1[20];
+               if (strlen(de->d_name) == GIT_SHA1_HEXSZ - 2)  {
+                       char hex[GIT_SHA1_HEXSZ+1];
+                       struct object_id oid;
 
                        snprintf(hex, sizeof(hex), "%02x%s",
                                 subdir_nr, de->d_name);
-                       if (!get_sha1_hex(hex, sha1)) {
+                       if (!get_oid_hex(hex, &oid)) {
                                if (obj_cb) {
-                                       r = obj_cb(sha1, path->buf, data);
+                                       r = obj_cb(&oid, path->buf, data);
                                        if (r)
                                                break;
                                }
@@ -3805,7 +3805,7 @@ static int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn c
                        return error("unable to get sha1 of object %u in %s",
                                     i, p->pack_name);
 
-               r = cb(oid.hash, p, i, data);
+               r = cb(&oid, p, i, data);
                if (r)
                        break;
        }