-
-struct linehash {
- unsigned long bytes;
- unsigned long hash;
-};
-
-static unsigned long hash_extended_line(const unsigned char **buf_p,
- unsigned long left)
-{
- /* An extended line is zero or more whitespace letters (including LF)
- * followed by one non whitespace letter followed by zero or more
- * non LF, and terminated with by a LF (or EOF).
- */
- const unsigned char *bol = *buf_p;
- const unsigned char *buf = bol;
- unsigned long hashval = 0;
- while (left) {
- unsigned c = *buf++;
- if (!c)
- goto binary;
- left--;
- if (' ' < c) {
- hashval = c;
- break;
- }
- }
- while (left) {
- unsigned c = *buf++;
- if (!c)
- goto binary;
- left--;
- if (c == '\n')
- break;
- if (' ' < c)
- hashval = hashval * 11 + c;
- }
- *buf_p = buf;
- return hashval;
-
- binary:
- *buf_p = NULL;
- return 0;
-}
-
-static int linehash_compare(const void *a_, const void *b_)
-{
- struct linehash *a = (struct linehash *) a_;
- struct linehash *b = (struct linehash *) b_;
- if (a->hash < b->hash) return -1;
- if (a->hash > b->hash) return 1;
- return 0;
-}
-
-static struct linehash *hash_lines(const unsigned char *buf,
- unsigned long size)
+#include "delta.h"
+#include "count-delta.h"
+
+static int diffcore_count_changes_1(void *src, unsigned long src_size,
+ void *dst, unsigned long dst_size,
+ unsigned long delta_limit,
+ unsigned long *src_copied,
+ unsigned long *literal_added)