add clean and ignore rules for xdiff/
[git/jnareb-git/bp-gitweb.git] / diffcore-delta.c
blob1e6a6911ecc7b9a6b6c28a20db9adea3e1238a2d
1 #include "cache.h"
2 #include "diff.h"
3 #include "diffcore.h"
4 #include "delta.h"
5 #include "count-delta.h"
7 static int diffcore_count_changes_1(void *src, unsigned long src_size,
8 void *dst, unsigned long dst_size,
9 unsigned long delta_limit,
10 unsigned long *src_copied,
11 unsigned long *literal_added)
13 void *delta;
14 unsigned long delta_size;
16 delta = diff_delta(src, src_size,
17 dst, dst_size,
18 &delta_size, delta_limit);
19 if (!delta)
20 /* If delta_limit is exceeded, we have too much differences */
21 return -1;
23 /* Estimate the edit size by interpreting delta. */
24 if (count_delta(delta, delta_size, src_copied, literal_added)) {
25 free(delta);
26 return -1;
28 free(delta);
29 return 0;
32 int diffcore_count_changes(void *src, unsigned long src_size,
33 void *dst, unsigned long dst_size,
34 unsigned long delta_limit,
35 unsigned long *src_copied,
36 unsigned long *literal_added)
38 return diffcore_count_changes_1(src, src_size,
39 dst, dst_size,
40 delta_limit,
41 src_copied,
42 literal_added);