if (!options->msg_type) {
int i;
- int *msg_type = xmalloc(sizeof(int) * FSCK_MSG_MAX);
+ int *msg_type;
+ ALLOC_ARRAY(msg_type, FSCK_MSG_MAX);
for (i = 0; i < FSCK_MSG_MAX; i++)
msg_type[i] = fsck_msg_type(i, options);
options->msg_type = msg_type;
return 0;
if (options->skiplist && object &&
- sha1_array_lookup(options->skiplist, object->sha1) >= 0)
+ sha1_array_lookup(options->skiplist, object->oid.hash) >= 0)
return 0;
if (msg_type == FSCK_FATAL)
result = options->walk(&lookup_blob(entry.sha1)->object, OBJ_BLOB, data, options);
else {
result = error("in tree %s: entry %s has bad mode %.6o",
- sha1_to_hex(tree->object.sha1), entry.path, entry.mode);
+ oid_to_hex(&tree->object.oid), entry.path, entry.mode);
}
if (result < 0)
return result;
case OBJ_TAG:
return fsck_walk_tag((struct tag *)obj, data, options);
default:
- error("Unknown object type for %s", sha1_to_hex(obj->sha1));
+ error("Unknown object type for %s", oid_to_hex(&obj->oid));
return -1;
}
}
buffer += 41;
parent_line_count++;
}
- graft = lookup_commit_graft(commit->object.sha1);
+ graft = lookup_commit_graft(commit->object.oid.hash);
parent_count = commit_list_count(commit->parents);
if (graft) {
if (graft->nr_parent == -1 && !parent_count)
enum object_type type;
buffer = to_free =
- read_sha1_file(tag->object.sha1, &type, &size);
+ read_sha1_file(tag->object.oid.hash, &type, &size);
if (!buffer)
return report(options, &tag->object,
FSCK_MSG_MISSING_TAG_OBJECT,
}
}
- if (verify_headers(buffer, size, &tag->object, options))
+ ret = verify_headers(buffer, size, &tag->object, options);
+ if (ret)
goto done;
if (!skip_prefix(buffer, "object ", &buffer)) {
int fsck_error_function(struct object *obj, int msg_type, const char *message)
{
if (msg_type == FSCK_WARN) {
- warning("object %s: %s", sha1_to_hex(obj->sha1), message);
+ warning("object %s: %s", oid_to_hex(&obj->oid), message);
return 0;
}
- error("object %s: %s", sha1_to_hex(obj->sha1), message);
+ error("object %s: %s", oid_to_hex(&obj->oid), message);
return 1;
}