[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.66 and 1.67

version 1.66, 2007/02/23 08:03:19 version 1.67, 2007/03/18 21:12:27
Line 195 
Line 195 
 static struct context_vec *context_vec_end;  static struct context_vec *context_vec_end;
 static struct context_vec *context_vec_ptr;  static struct context_vec *context_vec_ptr;
   
 #define FUNCTION_CONTEXT_SIZE   41  #define FUNCTION_CONTEXT_SIZE   55
 static char lastbuf[FUNCTION_CONTEXT_SIZE];  static char lastbuf[FUNCTION_CONTEXT_SIZE];
 static int lastline;  static int lastline;
 static int lastmatchline;  static int lastmatchline;
Line 1303 
Line 1303 
         return (a > b ? a : b);          return (a > b ? a : b);
 }  }
   
   #define begins_with(s, pre) (strncmp(s, pre, sizeof(pre)-1) == 0)
   
 static char *  static char *
 match_function(const long *f, int pos, FILE *file)  match_function(const long *f, int pos, FILE *file)
 {  {
Line 1310 
Line 1312 
         size_t nc;          size_t nc;
         int last = lastline;          int last = lastline;
         char *p;          char *p;
           char *state = NULL;
   
         lastline = pos;          lastline = pos;
         while (pos > last) {          while (pos > last) {
Line 1324 
Line 1327 
                         if (p != NULL)                          if (p != NULL)
                                 *p = '\0';                                  *p = '\0';
                         if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {                          if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {
                                 strlcpy(lastbuf, buf, sizeof lastbuf);                                  if (begins_with(buf, "private:")) {
                                 lastmatchline = pos;                                          if (!state)
                                 return lastbuf;                                                  state = " (private)";
                                   } else if (begins_with(buf, "protected:")) {
                                           if (!state)
                                                   state = " (protected)";
                                   } else if (begins_with(buf, "public:")) {
                                           if (!state)
                                                   state = " (public)";
                                   } else {
                                           strlcpy(lastbuf, buf, sizeof lastbuf);
                                           if (state)
                                                   strlcat(lastbuf, state,
                                                       sizeof lastbuf);
                                           lastmatchline = pos;
                                           return lastbuf;
                                   }
                         }                          }
                 }                  }
                 pos--;                  pos--;

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.67