builtin/difftool.c: drop hashmap_cmp_fn cast
[gitweb.git] / builtin / fast-export.c
index 64617ad8e362fff47381d34c36a914d9458a7d1a..d412c0a8f354659acade8ea6271f5c60826a0b3f 100644 (file)
@@ -5,6 +5,7 @@
  */
 #include "builtin.h"
 #include "cache.h"
+#include "config.h"
 #include "refs.h"
 #include "commit.h"
 #include "object.h"
@@ -92,8 +93,9 @@ struct anonymized_entry {
        size_t anon_len;
 };
 
-static int anonymized_entry_cmp(const void *va, const void *vb,
-                               const void *data)
+static int anonymized_entry_cmp(const void *unused_cmp_data,
+                               const void *va, const void *vb,
+                               const void *unused_keydata)
 {
        const struct anonymized_entry *a = va, *b = vb;
        return a->orig_len != b->orig_len ||
@@ -112,7 +114,7 @@ static const void *anonymize_mem(struct hashmap *map,
        struct anonymized_entry key, *ret;
 
        if (!map->cmpfn)
-               hashmap_init(map, anonymized_entry_cmp, 0);
+               hashmap_init(map, anonymized_entry_cmp, NULL, 0);
 
        hashmap_entry_init(&key, memhash(orig, *len));
        key.orig = orig;
@@ -232,7 +234,7 @@ static void export_blob(const struct object_id *oid)
 
        if (anonymize) {
                buf = anonymize_blob(&size);
-               object = (struct object *)lookup_blob(oid->hash);
+               object = (struct object *)lookup_blob(oid);
                eaten = 0;
        } else {
                buf = read_sha1_file(oid->hash, &type, &size);
@@ -240,7 +242,7 @@ static void export_blob(const struct object_id *oid)
                        die ("Could not read blob %s", oid_to_hex(oid));
                if (check_sha1_signature(oid->hash, buf, size, typename(type)) < 0)
                        die("sha1 mismatch in blob %s", oid_to_hex(oid));
-               object = parse_object_buffer(oid->hash, type, size, buf, &eaten);
+               object = parse_object_buffer(oid, type, size, buf, &eaten);
        }
 
        if (!object)
@@ -562,12 +564,12 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
            get_object_mark(&commit->parents->item->object) != 0 &&
            !full_tree) {
                parse_commit_or_die(commit->parents->item);
-               diff_tree_sha1(commit->parents->item->tree->object.oid.hash,
-                              commit->tree->object.oid.hash, "", &rev->diffopt);
+               diff_tree_oid(&commit->parents->item->tree->object.oid,
+                             &commit->tree->object.oid, "", &rev->diffopt);
        }
        else
-               diff_root_tree_sha1(commit->tree->object.oid.hash,
-                                   "", &rev->diffopt);
+               diff_root_tree_oid(&commit->tree->object.oid,
+                                  "", &rev->diffopt);
 
        /* Export the referenced blobs, and remember the marks. */
        for (i = 0; i < diff_queued_diff.nr; i++)
@@ -779,7 +781,7 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, char *full_name)
 
                /* handle nested tags */
                while (tag && tag->object.type == OBJ_TAG) {
-                       parse_object(tag->object.oid.hash);
+                       parse_object(&tag->object.oid);
                        string_list_append(&extra_refs, full_name)->util = tag;
                        tag = (struct tag *)tag->tagged;
                }
@@ -907,9 +909,7 @@ static void export_marks(char *file)
 static void import_marks(char *input_file)
 {
        char line[512];
-       FILE *f = fopen(input_file, "r");
-       if (!f)
-               die_errno("cannot read '%s'", input_file);
+       FILE *f = xfopen(input_file, "r");
 
        while (fgets(line, sizeof(line), f)) {
                uint32_t mark;
@@ -940,7 +940,7 @@ static void import_marks(char *input_file)
                        /* only commits */
                        continue;
 
-               commit = lookup_commit(oid.hash);
+               commit = lookup_commit(&oid);
                if (!commit)
                        die("not a commit? can't happen: %s", oid_to_hex(&oid));