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 <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed May 18, 2021 at 18:32 UTC f6e2cd0625c8f15505a1bc11828b21490dff59e6
1 file changed -64
read-cache.c
-64
@@ -2522,46 +2522,6 @@ int repo_index_has_changes(struct repository *repo,
2522 }
2523 }
2524
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 -
2525 static int write_index_ext_header(struct hashfile *f,
2526 git_hash_ctx *eoie_f,
2527 unsigned int ext,
@@ -2579,30 +2539,6 @@ static int write_index_ext_header(struct hashfile *f,
2539 return 0;
2540 }
2541
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 -
2542 static void ce_smudge_racily_clean_entry(struct index_state *istate,
2543 struct cache_entry *ce)
2544 {