*** empty log message ***
[rsync/rsync.git] / match.c
diff --git a/match.c b/match.c
index 971fa10..d7af159 100644 (file)
--- a/match.c
+++ b/match.c
@@ -88,7 +88,8 @@ static void build_hash_table(struct sum_struct *s)
 static off_t last_match;
 
 
-static void matched(int f,struct sum_struct *s,char *buf,off_t len,
+static void matched(int f,struct sum_struct *s,struct map_struct *buf,
+                   off_t len,
                    int offset,int i)
 {
   int n = offset - last_match;
@@ -98,17 +99,13 @@ static void matched(int f,struct sum_struct *s,char *buf,off_t len,
       fprintf(FERROR,"match at %d last_match=%d j=%d len=%d n=%d\n",
              (int)offset,(int)last_match,i,(int)s->sums[i].len,n);
 
-  if (n > 0) {
-    int l = 0;
-    write_int(f,n);
-    while (l < n) {
-      int n1 = MIN(CHUNK_SIZE,n-l);
-      write_buf(f,map_ptr(buf,last_match+l,n1),n1);
-      l += n1;
-    }
-    data_transfer += n;
-  }
-  write_int(f,-(i+1));
+  send_token(f,i,buf,last_match,n);
+
+  data_transfer += n;
+
+  if (i != -1)
+    last_match = offset + s->sums[i].len;
+  
   if (i != -1)
     last_match = offset + s->sums[i].len;
   if (n > 0)
@@ -116,7 +113,8 @@ static void matched(int f,struct sum_struct *s,char *buf,off_t len,
 }
 
 
-static void hash_search(int f,struct sum_struct *s,char *buf,off_t len)
+static void hash_search(int f,struct sum_struct *s,
+                       struct map_struct *buf,off_t len)
 {
   int offset,j,k;
   int end;
@@ -208,7 +206,7 @@ static void hash_search(int f,struct sum_struct *s,char *buf,off_t len)
 }
 
 
-void match_sums(int f,struct sum_struct *s,char *buf,off_t len)
+void match_sums(int f,struct sum_struct *s,struct map_struct *buf,off_t len)
 {
   last_match = 0;
   false_alarms = 0;