[BACK]Return to diffreg.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / diff

Diff for /src/usr.bin/diff/diffreg.c between version 1.3 and 1.4

version 1.3, 2003/06/25 03:02:33 version 1.4, 2003/06/25 03:25:29
Line 132 
Line 132 
 } *file[2], line;  } *file[2], line;
   
 int len[2];  int len[2];
 struct line *sfile[2];          /* shortened by pruning common prefix and  struct line *sfile[2];  /* shortened by pruning common prefix and suffix */
                                  * suffix */  
 int slen[2];  int slen[2];
 int pref, suff;                 /* length of prefix and suffix */  int pref, suff;                 /* length of prefix and suffix */
 int *class;                     /* will be overlaid on file[0] */  int *class;                     /* will be overlaid on file[0] */
Line 320 
Line 319 
   
         member = (int *)file[1];          member = (int *)file[1];
         equiv(sfile[0], slen[0], sfile[1], slen[1], member);          equiv(sfile[0], slen[0], sfile[1], slen[1], member);
         member = ralloc((char *) member, (slen[1] + 2) * sizeof(int));          member = ralloc(member, (slen[1] + 2) * sizeof(int));
   
         class = (int *) file[0];          class = (int *)file[0];
         unsort(sfile[0], slen[0], class);          unsort(sfile[0], slen[0], class);
         class = ralloc((char *) class, (slen[0] + 2) * sizeof(int));          class = ralloc(class, (slen[0] + 2) * sizeof(int));
   
         klist = talloc((slen[0] + 2) * sizeof(int));          klist = talloc((slen[0] + 2) * sizeof(int));
         clist = talloc(sizeof(cand));          clist = talloc(sizeof(cand));
Line 396 
Line 395 
 }  }
   
 static void  static void
 prepare(int i, FILE * fd)  prepare(int i, FILE *fd)
 {  {
         struct line *p;          struct line *p;
         int j, h;          int j, h;
Line 404 
Line 403 
         fseek(fd, 0, 0);          fseek(fd, 0, 0);
         p = talloc(3 * sizeof(line));          p = talloc(3 * sizeof(line));
         for (j = 0; (h = readhash(fd));) {          for (j = 0; (h = readhash(fd));) {
                 p = (struct line *) ralloc((char *) p, (++j + 3) * sizeof(line));                  p = ralloc(p, (++j + 3) * sizeof(line));
                 p[j].value = h;                  p[j].value = h;
         }          }
         len[i] = j;          len[i] = j;
Line 430 
Line 429 
 }  }
   
 static void  static void
 equiv(struct line * a, int n, struct line * b, int m, int *c)  equiv(struct line *a, int n, struct line *b, int m, int *c)
 {  {
         int i, j;          int i, j;
         i = j = 1;          i = j = 1;
Line 500 
Line 499 
 {  {
         struct cand *q;          struct cand *q;
   
         clist = (struct cand *) ralloc((char *) clist, ++clen * sizeof(cand));          clist = ralloc(clist, ++clen * sizeof(cand));
         q = clist + clen - 1;          q = clist + clen - 1;
         q->x = x;          q->x = x;
         q->y = y;          q->y = y;
Line 652 
Line 651 
 }  }
   
 static void  static void
 sort(struct line * a, int n)  sort(struct line *a, int n)
 {                               /* shellsort CACM #201 */  {                               /* shellsort CACM #201 */
         struct line w;          struct line w;
         int j, m = 0;           /* gcc */          int j, m = 0;           /* gcc */
Line 687 
Line 686 
 }  }
   
 static void  static void
 unsort(struct line * f, int l, int *b)  unsort(struct line *f, int l, int *b)
 {  {
         int *a;          int *a;
         int i;          int i;
Line 880 
Line 879 
 }  }
   
 static void  static void
 fetch(long *f, int a, int b, FILE * lb, char *s, int oldfile)  fetch(long *f, int a, int b, FILE *lb, char *s, int oldfile)
 {  {
         int i, j;          int i, j;
         int c;          int c;
Line 955 
Line 954 
  * summing 1-s complement in 16-bit hunks   * summing 1-s complement in 16-bit hunks
  */   */
 static int  static int
 readhash(FILE * f)  readhash(FILE *f)
 {  {
         long sum;          long sum;
         unsigned shift;          unsigned shift;
Line 1020 
Line 1019 
 }  }
   
 static int  static int
 asciifile(FILE * f)  asciifile(FILE *f)
 {  {
         char buf[BUFSIZ];          char buf[BUFSIZ];
         int cnt;          int cnt;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4