Skip to content

Commit f6e2cd0

Browse files
derrickstoleegitster
authored andcommitted
read-cache: delete unused hashing methods
These methods were marked as MAYBE_UNUSED in the previous change to avoid a complicated diff. Delete them entirely, since we now use the hashfile API instead of this custom hashing code. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 410334e commit f6e2cd0

File tree

1 file changed

+0
-64
lines changed

1 file changed

+0
-64
lines changed

read-cache.c

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,46 +2522,6 @@ int repo_index_has_changes(struct repository *repo,
25222522
}
25232523
}
25242524

2525-
#define WRITE_BUFFER_SIZE (128 * 1024)
2526-
static unsigned char write_buffer[WRITE_BUFFER_SIZE];
2527-
static unsigned long write_buffer_len;
2528-
2529-
MAYBE_UNUSED
2530-
static int ce_write_flush(git_hash_ctx *context, int fd)
2531-
{
2532-
unsigned int buffered = write_buffer_len;
2533-
if (buffered) {
2534-
the_hash_algo->update_fn(context, write_buffer, buffered);
2535-
if (write_in_full(fd, write_buffer, buffered) < 0)
2536-
return -1;
2537-
write_buffer_len = 0;
2538-
}
2539-
return 0;
2540-
}
2541-
2542-
MAYBE_UNUSED
2543-
static int ce_write(git_hash_ctx *context, int fd, void *data, unsigned int len)
2544-
{
2545-
while (len) {
2546-
unsigned int buffered = write_buffer_len;
2547-
unsigned int partial = WRITE_BUFFER_SIZE - buffered;
2548-
if (partial > len)
2549-
partial = len;
2550-
memcpy(write_buffer + buffered, data, partial);
2551-
buffered += partial;
2552-
if (buffered == WRITE_BUFFER_SIZE) {
2553-
write_buffer_len = buffered;
2554-
if (ce_write_flush(context, fd))
2555-
return -1;
2556-
buffered = 0;
2557-
}
2558-
write_buffer_len = buffered;
2559-
len -= partial;
2560-
data = (char *) data + partial;
2561-
}
2562-
return 0;
2563-
}
2564-
25652525
static int write_index_ext_header(struct hashfile *f,
25662526
git_hash_ctx *eoie_f,
25672527
unsigned int ext,
@@ -2579,30 +2539,6 @@ static int write_index_ext_header(struct hashfile *f,
25792539
return 0;
25802540
}
25812541

2582-
MAYBE_UNUSED
2583-
static int ce_flush(git_hash_ctx *context, int fd, unsigned char *hash)
2584-
{
2585-
unsigned int left = write_buffer_len;
2586-
2587-
if (left) {
2588-
write_buffer_len = 0;
2589-
the_hash_algo->update_fn(context, write_buffer, left);
2590-
}
2591-
2592-
/* Flush first if not enough space for hash signature */
2593-
if (left + the_hash_algo->rawsz > WRITE_BUFFER_SIZE) {
2594-
if (write_in_full(fd, write_buffer, left) < 0)
2595-
return -1;
2596-
left = 0;
2597-
}
2598-
2599-
/* Append the hash signature at the end */
2600-
the_hash_algo->final_fn(write_buffer + left, context);
2601-
hashcpy(hash, write_buffer + left);
2602-
left += the_hash_algo->rawsz;
2603-
return (write_in_full(fd, write_buffer, left) < 0) ? -1 : 0;
2604-
}
2605-
26062542
static void ce_smudge_racily_clean_entry(struct index_state *istate,
26072543
struct cache_entry *ce)
26082544
{

0 commit comments

Comments
 (0)