]> git.ipfire.org Git - thirdparty/git.git/commitdiff
hash: stop typedeffing the hash context
authorPatrick Steinhardt <ps@pks.im>
Fri, 31 Jan 2025 12:55:29 +0000 (13:55 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 31 Jan 2025 18:06:10 +0000 (10:06 -0800)
We generally avoid using `typedef` in the Git codebase. One exception
though is the `git_hash_ctx`, likely because it used to be a union
rather than a struct until the preceding commit refactored it. But now
that it is a normal `struct` there isn't really a need for a typedef
anymore.

Drop the typedef and adapt all callers accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
22 files changed:
builtin/fast-import.c
builtin/index-pack.c
builtin/patch-id.c
builtin/receive-pack.c
builtin/unpack-objects.c
bulk-checkin.c
csum-file.c
csum-file.h
diff.c
diff.h
hash.h
http-push.c
http.h
object-file.c
pack-check.c
pack-write.c
read-cache.c
rerere.c
t/helper/test-hash-speed.c
t/helper/test-hash.c
t/unit-tests/u-hash.c
trace2/tr2_sid.c

index ccdada1810ffe3ad85531278765e15a8313300d0..9862704c6252d1f373958cd3f60d89ee7e7e6eb7 100644 (file)
@@ -953,7 +953,7 @@ static int store_object(
        unsigned char hdr[96];
        struct object_id oid;
        unsigned long hdrlen, deltalen;
-       git_hash_ctx c;
+       struct git_hash_ctx c;
        git_zstream s;
 
        hdrlen = format_object_header((char *)hdr, sizeof(hdr), type,
@@ -1095,7 +1095,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
        struct object_id oid;
        unsigned long hdrlen;
        off_t offset;
-       git_hash_ctx c;
+       struct git_hash_ctx c;
        git_zstream s;
        struct hashfile_checkpoint checkpoint;
        int status = Z_OK;
index 6ffbb7ce35d53ae97280295503e71a6226f4a377..40e49868b18866dc8ecb507acb491ac752418a7f 100644 (file)
@@ -151,7 +151,7 @@ static unsigned int input_offset, input_len;
 static off_t consumed_bytes;
 static off_t max_input_size;
 static unsigned deepest_delta;
-static git_hash_ctx input_ctx;
+static struct git_hash_ctx input_ctx;
 static uint32_t input_crc32;
 static int input_fd, output_fd;
 static const char *curr_pack;
@@ -475,7 +475,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size,
        int status;
        git_zstream stream;
        void *buf;
-       git_hash_ctx c;
+       struct git_hash_ctx c;
        char hdr[32];
        int hdrlen;
 
@@ -1248,7 +1248,7 @@ static void parse_pack_objects(unsigned char *hash)
        struct ofs_delta_entry *ofs_delta = ofs_deltas;
        struct object_id ref_delta_oid;
        struct stat st;
-       git_hash_ctx tmp_ctx;
+       struct git_hash_ctx tmp_ctx;
 
        if (verbose)
                progress = start_progress(
index f540d8daa736b027649c8c64ffe5100cf4044037..923ff2bb77d11f4d0998eff82e2040abb1432e89 100644 (file)
@@ -70,7 +70,7 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu
        int before = -1, after = -1;
        int diff_is_binary = 0;
        char pre_oid_str[GIT_MAX_HEXSZ + 1], post_oid_str[GIT_MAX_HEXSZ + 1];
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
 
        the_hash_algo->init_fn(&ctx);
        oidclr(result, the_repository->hash_algo);
index 0fb0266cfd8f7ed21ef355ac8e92475ffa08eee0..d2360c453cdcd0225df04ded4a1d00eee04adbbc 100644 (file)
@@ -566,7 +566,7 @@ static void hmac_hash(unsigned char *out,
        unsigned char k_ipad[GIT_MAX_BLKSZ];
        unsigned char k_opad[GIT_MAX_BLKSZ];
        int i;
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
 
        /* RFC 2104 2. (1) */
        memset(key, '\0', GIT_MAX_BLKSZ);
index f6b9825fb0d26568909b6f8971f635af1ca2aaca..d72885510c3445e4f7c40a9ebe859a064f0dafb8 100644 (file)
@@ -28,7 +28,7 @@ static unsigned char buffer[4096];
 static unsigned int offset, len;
 static off_t consumed_bytes;
 static off_t max_input_size;
-static git_hash_ctx ctx;
+static struct git_hash_ctx ctx;
 static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;
 static struct progress *progress;
 
@@ -614,7 +614,7 @@ int cmd_unpack_objects(int argc,
 {
        int i;
        struct object_id oid;
-       git_hash_ctx tmp_ctx;
+       struct git_hash_ctx tmp_ctx;
 
        disable_replace_refs();
 
index f889fce734fd90646c93dcf3f121482f0980761b..db1958b52590dd4ef83a13f7b6aedee6c075cd56 100644 (file)
@@ -161,7 +161,7 @@ static int already_written(struct bulk_checkin_packfile *state, struct object_id
  * with a new pack.
  */
 static int stream_blob_to_pack(struct bulk_checkin_packfile *state,
-                              git_hash_ctx *ctx, off_t *already_hashed_to,
+                              struct git_hash_ctx *ctx, off_t *already_hashed_to,
                               int fd, size_t size, const char *path,
                               unsigned flags)
 {
@@ -258,7 +258,7 @@ static int deflate_blob_to_pack(struct bulk_checkin_packfile *state,
                                const char *path, unsigned flags)
 {
        off_t seekback, already_hashed_to;
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
        unsigned char obuf[16384];
        unsigned header_len;
        struct hashfile_checkpoint checkpoint;
index 232121f415fa50922da3f0cbe3ce4c51ce7f4976..338351566995534884a5fa8e7e22c37665979e82 100644 (file)
@@ -248,7 +248,7 @@ uint32_t crc32_end(struct hashfile *f)
 int hashfile_checksum_valid(const unsigned char *data, size_t total_len)
 {
        unsigned char got[GIT_MAX_RAWSZ];
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
        const struct git_hash_algo *algop = unsafe_hash_algo(the_hash_algo);
        size_t data_len = total_len - algop->rawsz;
 
index b7475f16c20e8a571f3b7e16831d1fdd4420d298..ffccbf09966c083b72c9f619c6b8406c59208515 100644 (file)
@@ -11,7 +11,7 @@ struct hashfile {
        int fd;
        int check_fd;
        unsigned int offset;
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
        off_t total;
        struct progress *tp;
        const char *name;
@@ -33,7 +33,7 @@ struct hashfile {
 /* Checkpoint */
 struct hashfile_checkpoint {
        off_t offset;
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
 };
 
 void hashfile_checkpoint_init(struct hashfile *, struct hashfile_checkpoint *);
diff --git a/diff.c b/diff.c
index 0822ae443361f80271c91a863a6f03b0e8c403c3..7f570ebdf95b5ee44fd282a22c1692e4bfae2494 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -6392,7 +6392,7 @@ static void diff_summary(struct diff_options *opt, struct diff_filepair *p)
 }
 
 struct patch_id_t {
-       git_hash_ctx *ctx;
+       struct git_hash_ctx *ctx;
        int patchlen;
 };
 
@@ -6409,7 +6409,7 @@ static int remove_space(char *line, int len)
        return dst - line;
 }
 
-void flush_one_hunk(struct object_id *result, git_hash_ctx *ctx)
+void flush_one_hunk(struct object_id *result, struct git_hash_ctx *ctx)
 {
        unsigned char hash[GIT_MAX_RAWSZ];
        unsigned short carry = 0;
@@ -6439,12 +6439,12 @@ static int patch_id_consume(void *priv, char *line, unsigned long len)
        return 0;
 }
 
-static void patch_id_add_string(git_hash_ctx *ctx, const char *str)
+static void patch_id_add_string(struct git_hash_ctx *ctx, const char *str)
 {
        the_hash_algo->update_fn(ctx, str, strlen(str));
 }
 
-static void patch_id_add_mode(git_hash_ctx *ctx, unsigned mode)
+static void patch_id_add_mode(struct git_hash_ctx *ctx, unsigned mode)
 {
        /* large enough for 2^32 in octal */
        char buf[12];
@@ -6457,7 +6457,7 @@ static int diff_get_patch_id(struct diff_options *options, struct object_id *oid
 {
        struct diff_queue_struct *q = &diff_queued_diff;
        int i;
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
        struct patch_id_t data;
 
        the_hash_algo->init_fn(&ctx);
diff --git a/diff.h b/diff.h
index 6e6007c17b01ada6eab3cb54e94b34b781335348..d56296dd21c3d96f5c5f4b7076fe61679afa961a 100644 (file)
--- a/diff.h
+++ b/diff.h
@@ -644,7 +644,7 @@ void run_diff_index(struct rev_info *revs, unsigned int option);
 
 int do_diff_cache(const struct object_id *, struct diff_options *);
 int diff_flush_patch_id(struct diff_options *, struct object_id *, int);
-void flush_one_hunk(struct object_id *result, git_hash_ctx *ctx);
+void flush_one_hunk(struct object_id *result, struct git_hash_ctx *ctx);
 
 int diff_result_code(struct rev_info *);
 
diff --git a/hash.h b/hash.h
index 5b88d9b714d8ad875dfa64b11ca5e1158a3336d5..42b52c6dae302172585f4f402be64d626a490c00 100644 (file)
--- a/hash.h
+++ b/hash.h
@@ -241,13 +241,12 @@ struct git_hash_ctx {
                git_SHA256_CTX sha256;
        } state;
 };
-typedef struct git_hash_ctx git_hash_ctx;
 
-typedef void (*git_hash_init_fn)(git_hash_ctx *ctx);
-typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src);
-typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len);
-typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx);
-typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx);
+typedef void (*git_hash_init_fn)(struct git_hash_ctx *ctx);
+typedef void (*git_hash_clone_fn)(struct git_hash_ctx *dst, const struct git_hash_ctx *src);
+typedef void (*git_hash_update_fn)(struct git_hash_ctx *ctx, const void *in, size_t len);
+typedef void (*git_hash_final_fn)(unsigned char *hash, struct git_hash_ctx *ctx);
+typedef void (*git_hash_final_oid_fn)(struct object_id *oid, struct git_hash_ctx *ctx);
 
 struct git_hash_algo {
        /*
index 43da1c7cd33b402ea77e3ce79e496f670ffdcc3b..36867af2f88918bb7f1d7ac86c08537a99c4a6f1 100644 (file)
@@ -760,7 +760,7 @@ static void handle_lockprop_ctx(struct xml_ctx *ctx, int tag_closed)
 static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed)
 {
        struct remote_lock *lock = (struct remote_lock *)ctx->userData;
-       git_hash_ctx hash_ctx;
+       struct git_hash_ctx hash_ctx;
        unsigned char lock_token_hash[GIT_MAX_RAWSZ];
 
        if (tag_closed && ctx->cdata) {
diff --git a/http.h b/http.h
index 46e334c2c2f239bceb5089105b26abd14e5a4387..36202139f451ffa1e5b2cbaeae49d0875a4f76a7 100644 (file)
--- a/http.h
+++ b/http.h
@@ -228,7 +228,7 @@ struct http_object_request {
        long http_code;
        struct object_id oid;
        struct object_id real_oid;
-       git_hash_ctx c;
+       struct git_hash_ctx c;
        git_zstream stream;
        int zret;
        int rename;
index 7505aa6b6073ae3297fa74eb0d15d07afdd2d561..154bcfce78627fd6ece537d82049bbf380096393 100644 (file)
@@ -86,82 +86,82 @@ static const struct object_id null_oid_sha256 = {
        .algo = GIT_HASH_SHA256,
 };
 
-static void git_hash_sha1_init(git_hash_ctx *ctx)
+static void git_hash_sha1_init(struct git_hash_ctx *ctx)
 {
        git_SHA1_Init(&ctx->state.sha1);
 }
 
-static void git_hash_sha1_clone(git_hash_ctx *dst, const git_hash_ctx *src)
+static void git_hash_sha1_clone(struct git_hash_ctx *dst, const struct git_hash_ctx *src)
 {
        git_SHA1_Clone(&dst->state.sha1, &src->state.sha1);
 }
 
-static void git_hash_sha1_update(git_hash_ctx *ctx, const void *data, size_t len)
+static void git_hash_sha1_update(struct git_hash_ctx *ctx, const void *data, size_t len)
 {
        git_SHA1_Update(&ctx->state.sha1, data, len);
 }
 
-static void git_hash_sha1_final(unsigned char *hash, git_hash_ctx *ctx)
+static void git_hash_sha1_final(unsigned char *hash, struct git_hash_ctx *ctx)
 {
        git_SHA1_Final(hash, &ctx->state.sha1);
 }
 
-static void git_hash_sha1_final_oid(struct object_id *oid, git_hash_ctx *ctx)
+static void git_hash_sha1_final_oid(struct object_id *oid, struct git_hash_ctx *ctx)
 {
        git_SHA1_Final(oid->hash, &ctx->state.sha1);
        memset(oid->hash + GIT_SHA1_RAWSZ, 0, GIT_MAX_RAWSZ - GIT_SHA1_RAWSZ);
        oid->algo = GIT_HASH_SHA1;
 }
 
-static void git_hash_sha1_init_unsafe(git_hash_ctx *ctx)
+static void git_hash_sha1_init_unsafe(struct git_hash_ctx *ctx)
 {
        git_SHA1_Init_unsafe(&ctx->state.sha1_unsafe);
 }
 
-static void git_hash_sha1_clone_unsafe(git_hash_ctx *dst, const git_hash_ctx *src)
+static void git_hash_sha1_clone_unsafe(struct git_hash_ctx *dst, const struct git_hash_ctx *src)
 {
        git_SHA1_Clone_unsafe(&dst->state.sha1_unsafe, &src->state.sha1_unsafe);
 }
 
-static void git_hash_sha1_update_unsafe(git_hash_ctx *ctx, const void *data,
+static void git_hash_sha1_update_unsafe(struct git_hash_ctx *ctx, const void *data,
                                      size_t len)
 {
        git_SHA1_Update_unsafe(&ctx->state.sha1_unsafe, data, len);
 }
 
-static void git_hash_sha1_final_unsafe(unsigned char *hash, git_hash_ctx *ctx)
+static void git_hash_sha1_final_unsafe(unsigned char *hash, struct git_hash_ctx *ctx)
 {
        git_SHA1_Final_unsafe(hash, &ctx->state.sha1_unsafe);
 }
 
-static void git_hash_sha1_final_oid_unsafe(struct object_id *oid, git_hash_ctx *ctx)
+static void git_hash_sha1_final_oid_unsafe(struct object_id *oid, struct git_hash_ctx *ctx)
 {
        git_SHA1_Final_unsafe(oid->hash, &ctx->state.sha1_unsafe);
        memset(oid->hash + GIT_SHA1_RAWSZ, 0, GIT_MAX_RAWSZ - GIT_SHA1_RAWSZ);
        oid->algo = GIT_HASH_SHA1;
 }
 
-static void git_hash_sha256_init(git_hash_ctx *ctx)
+static void git_hash_sha256_init(struct git_hash_ctx *ctx)
 {
        git_SHA256_Init(&ctx->state.sha256);
 }
 
-static void git_hash_sha256_clone(git_hash_ctx *dst, const git_hash_ctx *src)
+static void git_hash_sha256_clone(struct git_hash_ctx *dst, const struct git_hash_ctx *src)
 {
        git_SHA256_Clone(&dst->state.sha256, &src->state.sha256);
 }
 
-static void git_hash_sha256_update(git_hash_ctx *ctx, const void *data, size_t len)
+static void git_hash_sha256_update(struct git_hash_ctx *ctx, const void *data, size_t len)
 {
        git_SHA256_Update(&ctx->state.sha256, data, len);
 }
 
-static void git_hash_sha256_final(unsigned char *hash, git_hash_ctx *ctx)
+static void git_hash_sha256_final(unsigned char *hash, struct git_hash_ctx *ctx)
 {
        git_SHA256_Final(hash, &ctx->state.sha256);
 }
 
-static void git_hash_sha256_final_oid(struct object_id *oid, git_hash_ctx *ctx)
+static void git_hash_sha256_final_oid(struct object_id *oid, struct git_hash_ctx *ctx)
 {
        git_SHA256_Final(oid->hash, &ctx->state.sha256);
        /*
@@ -172,18 +172,18 @@ static void git_hash_sha256_final_oid(struct object_id *oid, git_hash_ctx *ctx)
        oid->algo = GIT_HASH_SHA256;
 }
 
-static void git_hash_unknown_init(git_hash_ctx *ctx UNUSED)
+static void git_hash_unknown_init(struct git_hash_ctx *ctx UNUSED)
 {
        BUG("trying to init unknown hash");
 }
 
-static void git_hash_unknown_clone(git_hash_ctx *dst UNUSED,
-                                  const git_hash_ctx *src UNUSED)
+static void git_hash_unknown_clone(struct git_hash_ctx *dst UNUSED,
+                                  const struct git_hash_ctx *src UNUSED)
 {
        BUG("trying to clone unknown hash");
 }
 
-static void git_hash_unknown_update(git_hash_ctx *ctx UNUSED,
+static void git_hash_unknown_update(struct git_hash_ctx *ctx UNUSED,
                                    const void *data UNUSED,
                                    size_t len UNUSED)
 {
@@ -191,13 +191,13 @@ static void git_hash_unknown_update(git_hash_ctx *ctx UNUSED,
 }
 
 static void git_hash_unknown_final(unsigned char *hash UNUSED,
-                                  git_hash_ctx *ctx UNUSED)
+                                  struct git_hash_ctx *ctx UNUSED)
 {
        BUG("trying to finalize unknown hash");
 }
 
 static void git_hash_unknown_final_oid(struct object_id *oid UNUSED,
-                                      git_hash_ctx *ctx UNUSED)
+                                      struct git_hash_ctx *ctx UNUSED)
 {
        BUG("trying to finalize unknown hash");
 }
@@ -1180,7 +1180,7 @@ int stream_object_signature(struct repository *r, const struct object_id *oid)
        unsigned long size;
        enum object_type obj_type;
        struct git_istream *st;
-       git_hash_ctx c;
+       struct git_hash_ctx c;
        char hdr[MAX_HEADER_LEN];
        int hdrlen;
 
@@ -1945,7 +1945,7 @@ void *read_object_with_reference(struct repository *r,
        }
 }
 
-static void hash_object_body(const struct git_hash_algo *algo, git_hash_ctx *c,
+static void hash_object_body(const struct git_hash_algo *algo, struct git_hash_ctx *c,
                             const void *buf, unsigned long len,
                             struct object_id *oid,
                             char *hdr, int *hdrlen)
@@ -1961,7 +1961,7 @@ static void write_object_file_prepare(const struct git_hash_algo *algo,
                                      enum object_type type, struct object_id *oid,
                                      char *hdr, int *hdrlen)
 {
-       git_hash_ctx c;
+       struct git_hash_ctx c;
 
        /* Generate the header */
        *hdrlen = format_object_header(hdr, *hdrlen, type, len);
@@ -1975,7 +1975,7 @@ static void write_object_file_prepare_literally(const struct git_hash_algo *algo
                                      const char *type, struct object_id *oid,
                                      char *hdr, int *hdrlen)
 {
-       git_hash_ctx c;
+       struct git_hash_ctx c;
 
        *hdrlen = format_object_header_literally(hdr, *hdrlen, type, len);
        hash_object_body(algo, &c, buf, len, oid, hdr, hdrlen);
@@ -2206,7 +2206,7 @@ static int start_loose_object_common(struct strbuf *tmp_file,
                                     const char *filename, unsigned flags,
                                     git_zstream *stream,
                                     unsigned char *buf, size_t buflen,
-                                    git_hash_ctx *c, git_hash_ctx *compat_c,
+                                    struct git_hash_ctx *c, struct git_hash_ctx *compat_c,
                                     char *hdr, int hdrlen)
 {
        struct repository *repo = the_repository;
@@ -2251,7 +2251,7 @@ static int start_loose_object_common(struct strbuf *tmp_file,
  * Common steps for the inner git_deflate() loop for writing loose
  * objects. Returns what git_deflate() returns.
  */
-static int write_loose_object_common(git_hash_ctx *c, git_hash_ctx *compat_c,
+static int write_loose_object_common(struct git_hash_ctx *c, struct git_hash_ctx *compat_c,
                                     git_zstream *stream, const int flush,
                                     unsigned char *in0, const int fd,
                                     unsigned char *compressed,
@@ -2280,7 +2280,7 @@ static int write_loose_object_common(git_hash_ctx *c, git_hash_ctx *compat_c,
  * - End the compression of zlib stream.
  * - Get the calculated oid to "oid".
  */
-static int end_loose_object_common(git_hash_ctx *c, git_hash_ctx *compat_c,
+static int end_loose_object_common(struct git_hash_ctx *c, struct git_hash_ctx *compat_c,
                                   git_zstream *stream, struct object_id *oid,
                                   struct object_id *compat_oid)
 {
@@ -2306,7 +2306,7 @@ static int write_loose_object(const struct object_id *oid, char *hdr,
        int fd, ret;
        unsigned char compressed[4096];
        git_zstream stream;
-       git_hash_ctx c;
+       struct git_hash_ctx c;
        struct object_id parano_oid;
        static struct strbuf tmp_file = STRBUF_INIT;
        static struct strbuf filename = STRBUF_INIT;
@@ -2386,7 +2386,7 @@ int stream_loose_object(struct input_stream *in_stream, size_t len,
        int fd, ret, err = 0, flush = 0;
        unsigned char compressed[4096];
        git_zstream stream;
-       git_hash_ctx c, compat_c;
+       struct git_hash_ctx c, compat_c;
        struct strbuf tmp_file = STRBUF_INIT;
        struct strbuf filename = STRBUF_INIT;
        int dirlen;
@@ -3046,7 +3046,7 @@ static int check_stream_oid(git_zstream *stream,
                            const char *path,
                            const struct object_id *expected_oid)
 {
-       git_hash_ctx c;
+       struct git_hash_ctx c;
        struct object_id real_oid;
        unsigned char buf[4096];
        unsigned long total_read;
index 8d9f6da7ce45f8a1bd83e0768d47d7e5ebe88493..f20209fccb45c15f96fd1c7074febc61bc2265c8 100644 (file)
@@ -58,7 +58,7 @@ static int verify_packfile(struct repository *r,
 {
        off_t index_size = p->index_size;
        const unsigned char *index_base = p->index_data;
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
        unsigned char hash[GIT_MAX_RAWSZ], *pack_sig;
        off_t offset = 0, pack_sig_ofs = 0;
        uint32_t nr_objects, i;
index 98a8c0e7853d7b46b5ce9a9672e0249ff051b5f9..9004d1d095790da7f13679ccba4d443906a7126c 100644 (file)
@@ -388,7 +388,7 @@ void fixup_pack_header_footer(int pack_fd,
                         off_t partial_pack_offset)
 {
        int aligned_sz, buf_sz = 8 * 1024;
-       git_hash_ctx old_hash_ctx, new_hash_ctx;
+       struct git_hash_ctx old_hash_ctx, new_hash_ctx;
        struct pack_header hdr;
        char *buf;
        ssize_t read_result;
index d54be2c17268728caf3e1e3ef94a5832d2cbfa60..5e765d9af5ec3849c6a69d320af738cb486c1d86 100644 (file)
@@ -1717,7 +1717,7 @@ int verify_ce_order;
 
 static int verify_hdr(const struct cache_header *hdr, unsigned long size)
 {
-       git_hash_ctx c;
+       struct git_hash_ctx c;
        unsigned char hash[GIT_MAX_RAWSZ];
        int hdr_version;
        unsigned char *start, *end;
@@ -2002,7 +2002,7 @@ static struct index_entry_offset_table *read_ieot_extension(const char *mmap, si
 static void write_ieot_extension(struct strbuf *sb, struct index_entry_offset_table *ieot);
 
 static size_t read_eoie_extension(const char *mmap, size_t mmap_size);
-static void write_eoie_extension(struct strbuf *sb, git_hash_ctx *eoie_context, size_t offset);
+static void write_eoie_extension(struct strbuf *sb, struct git_hash_ctx *eoie_context, size_t offset);
 
 struct load_index_extensions
 {
@@ -2566,7 +2566,7 @@ int repo_index_has_changes(struct repository *repo,
 }
 
 static int write_index_ext_header(struct hashfile *f,
-                                 git_hash_ctx *eoie_f,
+                                 struct git_hash_ctx *eoie_f,
                                  unsigned int ext,
                                  unsigned int sz)
 {
@@ -2831,7 +2831,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
 {
        uint64_t start = getnanotime();
        struct hashfile *f;
-       git_hash_ctx *eoie_c = NULL;
+       struct git_hash_ctx *eoie_c = NULL;
        struct cache_header hdr;
        int i, err = 0, removed, extended, hdr_version;
        struct cache_entry **cache = istate->cache;
@@ -3579,7 +3579,7 @@ static size_t read_eoie_extension(const char *mmap, size_t mmap_size)
        uint32_t extsize;
        size_t offset, src_offset;
        unsigned char hash[GIT_MAX_RAWSZ];
-       git_hash_ctx c;
+       struct git_hash_ctx c;
 
        /* ensure we have an index big enough to contain an EOIE extension */
        if (mmap_size < sizeof(struct cache_header) + EOIE_SIZE_WITH_HEADER + the_hash_algo->rawsz)
@@ -3650,7 +3650,7 @@ static size_t read_eoie_extension(const char *mmap, size_t mmap_size)
        return offset;
 }
 
-static void write_eoie_extension(struct strbuf *sb, git_hash_ctx *eoie_context, size_t offset)
+static void write_eoie_extension(struct strbuf *sb, struct git_hash_ctx *eoie_context, size_t offset)
 {
        uint32_t buffer;
        unsigned char hash[GIT_MAX_RAWSZ];
index e7fa6426b399e0337435003e2816ea9d021a379b..5ff9624b57d8699662a706751300895a04486f63 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -358,7 +358,7 @@ static void rerere_strbuf_putconflict(struct strbuf *buf, int ch, size_t size)
 }
 
 static int handle_conflict(struct strbuf *out, struct rerere_io *io,
-                          int marker_size, git_hash_ctx *ctx)
+                          int marker_size, struct git_hash_ctx *ctx)
 {
        enum {
                RR_SIDE_1 = 0, RR_SIDE_2, RR_ORIGINAL
@@ -432,7 +432,7 @@ static int handle_conflict(struct strbuf *out, struct rerere_io *io,
  */
 static int handle_path(unsigned char *hash, struct rerere_io *io, int marker_size)
 {
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
        struct strbuf buf = STRBUF_INIT, out = STRBUF_INIT;
        int has_conflicts = 0;
        if (hash)
index 80df1aae66b6242e91725bd7ad8d3e72742034b3..803f41c89de7bbbbfad39522ae2a770c7e639c03 100644 (file)
@@ -3,7 +3,7 @@
 
 #define NUM_SECONDS 3
 
-static inline void compute_hash(const struct git_hash_algo *algo, git_hash_ctx *ctx, uint8_t *final, const void *p, size_t len)
+static inline void compute_hash(const struct git_hash_algo *algo, struct git_hash_ctx *ctx, uint8_t *final, const void *p, size_t len)
 {
        algo->init_fn(ctx);
        algo->update_fn(ctx, p, len);
@@ -12,7 +12,7 @@ static inline void compute_hash(const struct git_hash_algo *algo, git_hash_ctx *
 
 int cmd__hash_speed(int ac, const char **av)
 {
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
        unsigned char hash[GIT_MAX_RAWSZ];
        clock_t initial, start, end;
        unsigned bufsizes[] = { 64, 256, 1024, 8192, 16384 };
index aa82638c621ea21f969832c37e1823b279a4138a..f9a3db487a97eb71946d9b92373aab6769d8c16f 100644 (file)
@@ -3,7 +3,7 @@
 
 int cmd_hash_impl(int ac, const char **av, int algo, int unsafe)
 {
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
        unsigned char hash[GIT_MAX_HEXSZ];
        unsigned bufsz = 8192;
        int binary = 0;
index a0320efe4b88e09b9678a7444292a9864b5ced69..05204e7b6c8fd90d4a98f42d824b0f9ec71e1c3e 100644 (file)
@@ -8,7 +8,7 @@ static void check_hash_data(const void *data, size_t data_length,
        cl_assert(data != NULL);
 
        for (size_t i = 1; i < ARRAY_SIZE(hash_algos); i++) {
-               git_hash_ctx ctx;
+               struct git_hash_ctx ctx;
                unsigned char hash[GIT_MAX_HEXSZ];
                const struct git_hash_algo *algop = &hash_algos[i];
 
index 09c4ef0d17378748ee67a870301f7b086bcf6163..c42696ef526703fb59968bb9d40af57d3e25f924 100644 (file)
@@ -32,7 +32,7 @@ static void tr2_sid_append_my_sid_component(void)
 {
        const struct git_hash_algo *algo = &hash_algos[GIT_HASH_SHA1];
        struct tr2_tbuf tb_now;
-       git_hash_ctx ctx;
+       struct git_hash_ctx ctx;
        pid_t pid = getpid();
        unsigned char hash[GIT_MAX_RAWSZ + 1];
        char hex[GIT_MAX_HEXSZ + 1];