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

Diff for /src/usr.bin/cvs/diff_internals.c between version 1.27 and 1.28

version 1.27, 2009/06/06 14:17:27 version 1.28, 2009/06/07 08:39:13
Line 295 
Line 295 
 };  };
   
 int  int
 cvs_diffreg(const char *file1, const char *file2, int _fd1, int _fd2,  diffreg(const char *file1, const char *file2, int _fd1, int _fd2,
     BUF *out, int flags)      BUF *out, int flags)
 {  {
         FILE *f1, *f2;          FILE *f1, *f2;
Line 318 
Line 318 
   
         fd1 = dup(_fd1);          fd1 = dup(_fd1);
         if (fd1 == -1)          if (fd1 == -1)
                 fatal("cvs_diffreg: dup: %s", strerror(errno));                  fatal("diffreg: dup: %s", strerror(errno));
   
         fd2 = dup(_fd2);          fd2 = dup(_fd2);
         if (fd2 == -1)          if (fd2 == -1)
                 fatal("cvs_diffreg: dup: %s", strerror(errno));                  fatal("diffreg: dup: %s", strerror(errno));
   
         if (lseek(fd1, 0, SEEK_SET) < 0)          if (lseek(fd1, 0, SEEK_SET) < 0)
                 fatal("cvs_diffreg: lseek: %s", strerror(errno));                  fatal("diffreg: lseek: %s", strerror(errno));
   
         f1 = fdopen(fd1, "r");          f1 = fdopen(fd1, "r");
         if (f1 == NULL) {          if (f1 == NULL) {
Line 334 
Line 334 
         }          }
   
         if (lseek(fd2, 0, SEEK_SET) < 0)          if (lseek(fd2, 0, SEEK_SET) < 0)
                 fatal("cvs_diffreg: lseek: %s", strerror(errno));                  fatal("diffreg: lseek: %s", strerror(errno));
   
         f2 = fdopen(fd2, "r");          f2 = fdopen(fd2, "r");
         if (f2 == NULL) {          if (f2 == NULL) {
Line 544 
Line 544 
   
         /* XXX move the isqrt() out of the macro to avoid multiple calls */          /* XXX move the isqrt() out of the macro to avoid multiple calls */
         const u_int bound = (flags & D_MINIMAL) ? UINT_MAX :          const u_int bound = (flags & D_MINIMAL) ? UINT_MAX :
             MAX(256, (u_int)isqrt(n));              MAX(256, isqrt(n));
   
         k = 0;          k = 0;
         c[0] = newcand(0, 0, 0);          c[0] = newcand(0, 0, 0);
Line 1224 
Line 1224 
         unsigned char buf[FUNCTION_CONTEXT_SIZE];          unsigned char buf[FUNCTION_CONTEXT_SIZE];
         size_t nc;          size_t nc;
         int last = lastline;          int last = lastline;
         char *p;  
         char *state = NULL;          char *state = NULL;
   
         lastline = pos;          lastline = pos;
Line 1236 
Line 1235 
                 nc = fread(buf, 1, nc, fp);                  nc = fread(buf, 1, nc, fp);
                 if (nc > 0) {                  if (nc > 0) {
                         buf[nc] = '\0';                          buf[nc] = '\0';
                         p = strchr((const char *)buf, '\n');                          buf[strcspn(buf, "\n")] = '\0';
                         if (p != NULL)  
                                 *p = '\0';  
                         if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {                          if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {
                                 if (begins_with(buf, "private:")) {                                  if (begins_with(buf, "private:")) {
                                         if (!state)                                          if (!state)
Line 1250 
Line 1247 
                                         if (!state)                                          if (!state)
                                                 state = " (public)";                                                  state = " (public)";
                                 } else {                                  } else {
                                         strlcpy(lastbuf, buf,                                          strlcpy(lastbuf, buf, sizeof lastbuf);
                                             sizeof lastbuf);  
                                         if (state)                                          if (state)
                                                 strlcat(lastbuf, state,                                                  strlcat(lastbuf, state,
                                                     sizeof lastbuf);                                                      sizeof lastbuf);

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28