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,
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;
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;
int status;
git_zstream stream;
void *buf;
- git_hash_ctx c;
+ struct git_hash_ctx c;
char hdr[32];
int hdrlen;
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(
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);
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);
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;
{
int i;
struct object_id oid;
- git_hash_ctx tmp_ctx;
+ struct git_hash_ctx tmp_ctx;
disable_replace_refs();
* 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)
{
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;
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;
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;
/* 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 *);
}
struct patch_id_t {
- git_hash_ctx *ctx;
+ struct git_hash_ctx *ctx;
int patchlen;
};
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;
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];
{
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);
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 *);
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 {
/*
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) {
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;
.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);
/*
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)
{
}
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");
}
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;
}
}
-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)
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);
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);
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;
* 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,
* - 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)
{
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;
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;
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;
{
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;
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;
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;
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
{
}
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)
{
{
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;
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)
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];
}
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
*/
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)
#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);
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 };
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;
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];
{
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];