[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.56 and 1.57

version 1.56, 2004/06/18 07:23:50 version 1.57, 2004/06/20 18:47:45
Line 214 
Line 214 
 static void unsort(struct line *, int, int *);  static void unsort(struct line *, int, int *);
 static void change(char *, FILE *, char *, FILE *, int, int, int, int);  static void change(char *, FILE *, char *, FILE *, int, int, int, int);
 static void sort(struct line *, int);  static void sort(struct line *, int);
   static int  ignoreline(char *);
 static int  asciifile(FILE *);  static int  asciifile(FILE *);
 static int  fetch(long *, int, int, FILE *, int, int);  static int  fetch(long *, int, int, FILE *, int, int);
 static int  newcand(int, int, int);  static int  newcand(int, int, int);
Line 226 
Line 227 
 static __inline int min(int, int);  static __inline int min(int, int);
 static __inline int max(int, int);  static __inline int max(int, int);
 static char *match_function(const long *, int, FILE *);  static char *match_function(const long *, int, FILE *);
   static char *preadline(int, size_t, off_t);
   
   
 /*  /*
Line 965 
Line 967 
                 printf("%d,0", b);                  printf("%d,0", b);
 }  }
   
   static char *
   preadline(int fd, size_t len, off_t off)
   {
           char *line;
           ssize_t nr;
   
           line = emalloc(len + 1);
           if ((nr = pread(fd, line, len, off)) < 0)
                   err(1, "preadline");
           line[nr] = '\0';
           return (line);
   }
   
   static int
   ignoreline(char *line)
   {
           int ret;
   
           ret = regexec(&ignore_re, line, 0, NULL, 0);
           free(line);
           return (ret == 0);      /* if it matched, it should be ignored. */
   }
   
 /*  /*
  * Indicate that there is a difference between lines a and b of the from file   * Indicate that there is a difference between lines a and b of the from file
  * to get to lines c to d of the to file.  If a is greater then b then there   * to get to lines c to d of the to file.  If a is greater then b then there
Line 981 
Line 1006 
 restart:  restart:
         if (format != D_IFDEF && a > b && c > d)          if (format != D_IFDEF && a > b && c > d)
                 return;                  return;
           if (ignore_pats != NULL) {
                   char *line;
                   /*
                    * All lines in the change, insert, or delete must
                    * match an ignore pattern for the change to be
                    * ignored.
                    */
                   if (a <= b) {           /* Changes and deletes. */
                           for (i = a; i <= b; i++) {
                                   line = preadline(fileno(f1),
                                       ixold[i] - ixold[i - 1], ixold[i - 1]);
                                   if (!ignoreline(line))
                                           goto proceed;
                           }
                   }
                   if (a > b || c <= d) {  /* Changes and inserts. */
                           for (i = c; i <= d; i++) {
                                   line = preadline(fileno(f2),
                                       ixnew[i] - ixnew[i - 1], ixnew[i - 1]);
                                   if (!ignoreline(line))
                                           goto proceed;
                           }
                   }
                   return;
           }
   proceed:
         if (format == D_CONTEXT || format == D_UNIFIED) {          if (format == D_CONTEXT || format == D_UNIFIED) {
                 /*                  /*
                  * Allocate change records as needed.                   * Allocate change records as needed.

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57