-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
diffcore-rename: split out the delta counting code.
This is to rework diffcore break/rename/copy detection code so that it does not affected when deltifier code gets improved. Signed-off-by: Junio C Hamano <junkio@cox.net>
- Loading branch information
Junio C Hamano
committed
Mar 1, 2006
1 parent
aeecd23
commit 6541675
Showing
5 changed files
with
61 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "cache.h" | ||
#include "diff.h" | ||
#include "diffcore.h" | ||
#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) | ||
{ | ||
void *delta; | ||
unsigned long delta_size; | ||
|
||
delta = diff_delta(src, src_size, | ||
dst, dst_size, | ||
&delta_size, delta_limit); | ||
if (!delta) | ||
/* If delta_limit is exceeded, we have too much differences */ | ||
return -1; | ||
|
||
/* Estimate the edit size by interpreting delta. */ | ||
if (count_delta(delta, delta_size, src_copied, literal_added)) { | ||
free(delta); | ||
return -1; | ||
} | ||
free(delta); | ||
return 0; | ||
} | ||
|
||
int diffcore_count_changes(void *src, unsigned long src_size, | ||
void *dst, unsigned long dst_size, | ||
unsigned long delta_limit, | ||
unsigned long *src_copied, | ||
unsigned long *literal_added) | ||
{ | ||
return diffcore_count_changes_1(src, src_size, | ||
dst, dst_size, | ||
delta_limit, | ||
src_copied, | ||
literal_added); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters