diff options
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/fast-import.c | 12 | ||||
| -rw-r--r-- | builtin/index-pack.c | 13 | ||||
| -rw-r--r-- | builtin/patch-id.c | 12 | ||||
| -rw-r--r-- | builtin/receive-pack.c | 16 | ||||
| -rw-r--r-- | builtin/unpack-objects.c | 9 |
5 files changed, 30 insertions, 32 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 9862704c62..91f88c467f 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -959,9 +959,9 @@ static int store_object( hdrlen = format_object_header((char *)hdr, sizeof(hdr), type, dat->len); the_hash_algo->init_fn(&c); - the_hash_algo->update_fn(&c, hdr, hdrlen); - the_hash_algo->update_fn(&c, dat->buf, dat->len); - the_hash_algo->final_oid_fn(&oid, &c); + git_hash_update(&c, hdr, hdrlen); + git_hash_update(&c, dat->buf, dat->len); + git_hash_final_oid(&oid, &c); if (oidout) oidcpy(oidout, &oid); @@ -1113,7 +1113,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark) hdrlen = format_object_header((char *)out_buf, out_sz, OBJ_BLOB, len); the_hash_algo->init_fn(&c); - the_hash_algo->update_fn(&c, out_buf, hdrlen); + git_hash_update(&c, out_buf, hdrlen); crc32_begin(pack_file); @@ -1131,7 +1131,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark) if (!n && feof(stdin)) die("EOF in data (%" PRIuMAX " bytes remaining)", len); - the_hash_algo->update_fn(&c, in_buf, n); + git_hash_update(&c, in_buf, n); s.next_in = in_buf; s.avail_in = n; len -= n; @@ -1157,7 +1157,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark) } } git_deflate_end(&s); - the_hash_algo->final_oid_fn(&oid, &c); + git_hash_final_oid(&oid, &c); if (oidout) oidcpy(oidout, &oid); diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 40e49868b1..5ee13661a1 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -301,7 +301,7 @@ static void flush(void) if (input_offset) { if (output_fd >= 0) write_or_die(output_fd, input_buffer, input_offset); - the_hash_algo->update_fn(&input_ctx, input_buffer, input_offset); + git_hash_update(&input_ctx, input_buffer, input_offset); memmove(input_buffer, input_buffer + input_offset, input_len); input_offset = 0; } @@ -482,7 +482,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size, if (!is_delta_type(type)) { hdrlen = format_object_header(hdr, sizeof(hdr), type, size); the_hash_algo->init_fn(&c); - the_hash_algo->update_fn(&c, hdr, hdrlen); + git_hash_update(&c, hdr, hdrlen); } else oid = NULL; if (type == OBJ_BLOB && size > big_file_threshold) @@ -502,7 +502,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size, status = git_inflate(&stream, 0); use(input_len - stream.avail_in); if (oid) - the_hash_algo->update_fn(&c, last_out, stream.next_out - last_out); + git_hash_update(&c, last_out, stream.next_out - last_out); if (buf == fixed_buf) { stream.next_out = buf; stream.avail_out = sizeof(fixed_buf); @@ -512,7 +512,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size, bad_object(offset, _("inflate returned %d"), status); git_inflate_end(&stream); if (oid) - the_hash_algo->final_oid_fn(oid, &c); + git_hash_final_oid(oid, &c); return buf == fixed_buf ? NULL : buf; } @@ -1286,9 +1286,8 @@ static void parse_pack_objects(unsigned char *hash) /* Check pack integrity */ flush(); - the_hash_algo->init_fn(&tmp_ctx); - the_hash_algo->clone_fn(&tmp_ctx, &input_ctx); - the_hash_algo->final_fn(hash, &tmp_ctx); + git_hash_clone(&tmp_ctx, &input_ctx); + git_hash_final(hash, &tmp_ctx); if (!hasheq(fill(the_hash_algo->rawsz), hash, the_repository->hash_algo)) die(_("pack is corrupted (SHA1 mismatch)")); use(the_hash_algo->rawsz); diff --git a/builtin/patch-id.c b/builtin/patch-id.c index 923ff2bb77..cdef2ec10a 100644 --- a/builtin/patch-id.c +++ b/builtin/patch-id.c @@ -85,7 +85,7 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu !skip_prefix(line, "From ", &p) && starts_with(line, "\\ ") && 12 < strlen(line)) { if (verbatim) - the_hash_algo->update_fn(&ctx, line, strlen(line)); + git_hash_update(&ctx, line, strlen(line)); continue; } @@ -104,10 +104,10 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu starts_with(line, "Binary files")) { diff_is_binary = 1; before = 0; - the_hash_algo->update_fn(&ctx, pre_oid_str, - strlen(pre_oid_str)); - the_hash_algo->update_fn(&ctx, post_oid_str, - strlen(post_oid_str)); + git_hash_update(&ctx, pre_oid_str, + strlen(pre_oid_str)); + git_hash_update(&ctx, post_oid_str, + strlen(post_oid_str)); if (stable) flush_one_hunk(result, &ctx); continue; @@ -165,7 +165,7 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu /* Add line to hash algo (possibly removing whitespace) */ len = verbatim ? strlen(line) : remove_space(line); patchlen += len; - the_hash_algo->update_fn(&ctx, line, len); + git_hash_update(&ctx, line, len); } if (!found_next) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index d2360c453c..cc358600ca 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -572,8 +572,8 @@ static void hmac_hash(unsigned char *out, memset(key, '\0', GIT_MAX_BLKSZ); if (the_hash_algo->blksz < key_len) { the_hash_algo->init_fn(&ctx); - the_hash_algo->update_fn(&ctx, key_in, key_len); - the_hash_algo->final_fn(key, &ctx); + git_hash_update(&ctx, key_in, key_len); + git_hash_final(key, &ctx); } else { memcpy(key, key_in, key_len); } @@ -586,15 +586,15 @@ static void hmac_hash(unsigned char *out, /* RFC 2104 2. (3) & (4) */ the_hash_algo->init_fn(&ctx); - the_hash_algo->update_fn(&ctx, k_ipad, sizeof(k_ipad)); - the_hash_algo->update_fn(&ctx, text, text_len); - the_hash_algo->final_fn(out, &ctx); + git_hash_update(&ctx, k_ipad, sizeof(k_ipad)); + git_hash_update(&ctx, text, text_len); + git_hash_final(out, &ctx); /* RFC 2104 2. (6) & (7) */ the_hash_algo->init_fn(&ctx); - the_hash_algo->update_fn(&ctx, k_opad, sizeof(k_opad)); - the_hash_algo->update_fn(&ctx, out, the_hash_algo->rawsz); - the_hash_algo->final_fn(out, &ctx); + git_hash_update(&ctx, k_opad, sizeof(k_opad)); + git_hash_update(&ctx, out, the_hash_algo->rawsz); + git_hash_final(out, &ctx); } static char *prepare_push_cert_nonce(const char *path, timestamp_t stamp) diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index d72885510c..8383bcf404 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -70,7 +70,7 @@ static void *fill(int min) if (min > sizeof(buffer)) die("cannot fill %d bytes", min); if (offset) { - the_hash_algo->update_fn(&ctx, buffer, offset); + git_hash_update(&ctx, buffer, offset); memmove(buffer, buffer + offset, len); offset = 0; } @@ -667,10 +667,9 @@ int cmd_unpack_objects(int argc, } the_hash_algo->init_fn(&ctx); unpack_all(); - the_hash_algo->update_fn(&ctx, buffer, offset); - the_hash_algo->init_fn(&tmp_ctx); - the_hash_algo->clone_fn(&tmp_ctx, &ctx); - the_hash_algo->final_oid_fn(&oid, &tmp_ctx); + git_hash_update(&ctx, buffer, offset); + git_hash_clone(&tmp_ctx, &ctx); + git_hash_final_oid(&oid, &tmp_ctx); if (strict) { write_rest(); if (fsck_finish(&fsck_options)) |
