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

Diff for /src/usr.bin/cvs/buf.c between version 1.18 and 1.19

version 1.18, 2005/08/14 19:49:18 version 1.19, 2005/12/10 20:27:45
Line 38 
Line 38 
   
 #include "buf.h"  #include "buf.h"
 #include "log.h"  #include "log.h"
   #include "xmalloc.h"
   
   
 #define BUF_INCR        128  #define BUF_INCR        128
   
   
Line 76 
Line 76 
 {  {
         BUF *b;          BUF *b;
   
         b = (BUF *)malloc(sizeof(*b));          b = (BUF *)xmalloc(sizeof(*b));
         if (b == NULL) {          b->cb_buf = xmalloc(len);
                 cvs_log(LP_ERRNO, "failed to allocate buffer");  
                 return (NULL);  
         }  
   
         b->cb_buf = malloc(len);  
         if (b->cb_buf == NULL) {  
                 cvs_log(LP_ERRNO, "failed to allocate buffer");  
                 free(b);  
                 return (NULL);  
         }  
         memset(b->cb_buf, 0, len);          memset(b->cb_buf, 0, len);
   
         b->cb_flags = flags;          b->cb_flags = flags;
Line 162 
Line 152 
 void  void
 cvs_buf_free(BUF *b)  cvs_buf_free(BUF *b)
 {  {
         free(b->cb_buf);          xfree(b->cb_buf);
         free(b);          xfree(b);
 }  }
   
   
Line 180 
Line 170 
         u_char *tmp;          u_char *tmp;
   
         tmp = b->cb_buf;          tmp = b->cb_buf;
         free(b);          xfree(b);
         return (tmp);          return (tmp);
 }  }
   
Line 339 
Line 329 
         }          }
   
         ret = cvs_buf_append(b, str, (size_t)ret);          ret = cvs_buf_append(b, str, (size_t)ret);
         free(str);          xfree(str);
         return (ret);          return (ret);
 }  }
   
Line 473 
Line 463 
         size_t diff;          size_t diff;
   
         diff = b->cb_cur - b->cb_buf;          diff = b->cb_cur - b->cb_buf;
         tmp = realloc(b->cb_buf, b->cb_size + len);          tmp = xrealloc(b->cb_buf, b->cb_size + len);
         if (tmp == NULL) {  
                 cvs_log(LP_ERRNO, "failed to grow buffer");  
                 return (-1);  
         }  
         b->cb_buf = (u_char *)tmp;          b->cb_buf = (u_char *)tmp;
         b->cb_size += len;          b->cb_size += len;
   

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19