Skip to content

Instantly share code, notes, and snippets.

@pencilcheck
Created March 5, 2012 14:39
Show Gist options
  • Save pencilcheck/1978574 to your computer and use it in GitHub Desktop.
Save pencilcheck/1978574 to your computer and use it in GitHub Desktop.
diff -crB librsync-0.9.7/delta.c librsync-0.9.7-new/delta.c
*** librsync-0.9.7/delta.c 2004-09-18 05:35:49.000000000 +0800
--- librsync-0.9.7-new/delta.c 2012-03-05 23:03:56.000000000 +0800
***************
*** 125,136 ****
static rs_result rs_delta_s_flush(rs_job_t *job);
static rs_result rs_delta_s_end(rs_job_t *job);
void rs_getinput(rs_job_t *job);
! inline int rs_findmatch(rs_job_t *job, rs_long_t *match_pos, size_t *match_len);
! inline rs_result rs_appendmatch(rs_job_t *job, rs_long_t match_pos, size_t match_len);
! inline rs_result rs_appendmiss(rs_job_t *job, size_t miss_len);
! inline rs_result rs_appendflush(rs_job_t *job);
! inline rs_result rs_processmatch(rs_job_t *job);
! inline rs_result rs_processmiss(rs_job_t *job);
/**
* \brief Get a block of data if possible, and see if it matches.
--- 125,136 ----
static rs_result rs_delta_s_flush(rs_job_t *job);
static rs_result rs_delta_s_end(rs_job_t *job);
void rs_getinput(rs_job_t *job);
! int rs_findmatch(rs_job_t *job, rs_long_t *match_pos, size_t *match_len);
! rs_result rs_appendmatch(rs_job_t *job, rs_long_t match_pos, size_t match_len);
! rs_result rs_appendmiss(rs_job_t *job, size_t miss_len);
! rs_result rs_appendflush(rs_job_t *job);
! rs_result rs_processmatch(rs_job_t *job);
! rs_result rs_processmiss(rs_job_t *job);
/**
* \brief Get a block of data if possible, and see if it matches.
***************
*** 254,260 ****
* forwards beyond the block boundaries. Extending backwards would require
* decrementing scoop_pos as appropriate.
*/
! inline int rs_findmatch(rs_job_t *job, rs_long_t *match_pos, size_t *match_len) {
/* calculate the weak_sum if we don't have one */
if (job->weak_sum.count == 0) {
/* set match_len to min(block_len, scan_avail) */
--- 254,260 ----
* forwards beyond the block boundaries. Extending backwards would require
* decrementing scoop_pos as appropriate.
*/
! int rs_findmatch(rs_job_t *job, rs_long_t *match_pos, size_t *match_len) {
/* calculate the weak_sum if we don't have one */
if (job->weak_sum.count == 0) {
/* set match_len to min(block_len, scan_avail) */
***************
*** 281,287 ****
/**
* Append a match at match_pos of length match_len to the delta, extending
* a previous match if possible, or flushing any previous miss/match. */
! inline rs_result rs_appendmatch(rs_job_t *job, rs_long_t match_pos, size_t match_len)
{
rs_result result=RS_DONE;
--- 281,287 ----
/**
* Append a match at match_pos of length match_len to the delta, extending
* a previous match if possible, or flushing any previous miss/match. */
! rs_result rs_appendmatch(rs_job_t *job, rs_long_t match_pos, size_t match_len)
{
rs_result result=RS_DONE;
***************
*** 312,318 ****
*
* This also breaks misses up into block_len segments to avoid accumulating
* too much in memory. */
! inline rs_result rs_appendmiss(rs_job_t *job, size_t miss_len)
{
rs_result result=RS_DONE;
--- 312,318 ----
*
* This also breaks misses up into block_len segments to avoid accumulating
* too much in memory. */
! rs_result rs_appendmiss(rs_job_t *job, size_t miss_len)
{
rs_result result=RS_DONE;
***************
*** 329,335 ****
/**
* Flush any accumulating hit or miss, appending it to the delta.
*/
! inline rs_result rs_appendflush(rs_job_t *job)
{
/* if last is a match, emit it and reset last by resetting basis_len */
if (job->basis_len) {
--- 329,335 ----
/**
* Flush any accumulating hit or miss, appending it to the delta.
*/
! rs_result rs_appendflush(rs_job_t *job)
{
/* if last is a match, emit it and reset last by resetting basis_len */
if (job->basis_len) {
***************
*** 360,366 ****
* scoop_pos appropriately. In the future this could be used for something
* like context compressing of miss data. Note that it also calls
* rs_tube_catchup to output any pending output. */
! inline rs_result rs_processmatch(rs_job_t *job)
{
job->scoop_avail-=job->scoop_pos;
job->scoop_next+=job->scoop_pos;
--- 360,366 ----
* scoop_pos appropriately. In the future this could be used for something
* like context compressing of miss data. Note that it also calls
* rs_tube_catchup to output any pending output. */
! rs_result rs_processmatch(rs_job_t *job)
{
job->scoop_avail-=job->scoop_pos;
job->scoop_next+=job->scoop_pos;
***************
*** 382,388 ****
*
* In the future this could do compression of miss data before outputing
* it. */
! inline rs_result rs_processmiss(rs_job_t *job)
{
rs_tube_copy(job, job->scoop_pos);
job->scoop_pos=0;
--- 382,388 ----
*
* In the future this could do compression of miss data before outputing
* it. */
! rs_result rs_processmiss(rs_job_t *job)
{
rs_tube_copy(job, job->scoop_pos);
job->scoop_pos=0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment