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

Diff for /src/usr.bin/rcs/buf.c between version 1.17 and 1.18

version 1.17, 2010/09/08 15:13:39 version 1.18, 2010/09/08 20:49:11
Line 53 
Line 53 
 static void     buf_grow(BUF *, size_t);  static void     buf_grow(BUF *, size_t);
   
 /*  /*
  * buf_alloc()  
  *  
  * Create a new buffer structure and return a pointer to it.  This structure   * Create a new buffer structure and return a pointer to it.  This structure
  * uses dynamically-allocated memory and must be freed with buf_free(),   * uses dynamically-allocated memory and must be freed with buf_free(), once
  * once the buffer is no longer needed.   * the buffer is no longer needed.
  */   */
 BUF *  BUF *
 buf_alloc(size_t len)  buf_alloc(size_t len)
Line 78 
Line 76 
 }  }
   
 /*  /*
  * buf_load()  
  *  
  * Open the file specified by <path> and load all of its contents into a   * Open the file specified by <path> and load all of its contents into a
  * buffer.   * buffer.
  * Returns the loaded buffer on success or NULL on failure.   * Returns the loaded buffer on success or NULL on failure.
Line 147 
Line 143 
 }  }
   
 /*  /*
  * buf_release()  
  *  
  * Free the buffer <b>'s structural information but do not free the contents   * Free the buffer <b>'s structural information but do not free the contents
  * of the buffer.  Instead, they are returned and should be freed later using   * of the buffer.  Instead, they are returned and should be freed later using
  * free().   * xfree().
  */   */
 void *  void *
 buf_release(BUF *b)  buf_release(BUF *b)
Line 163 
Line 157 
         return (tmp);          return (tmp);
 }  }
   
 /*  
  * buf_get()  
  */  
 u_char *  u_char *
 buf_get(BUF *b)  buf_get(BUF *b)
 {  {
Line 173 
Line 164 
 }  }
   
 /*  /*
  * buf_empty()  
  *  
  * Empty the contents of the buffer <b> and reset pointers.   * Empty the contents of the buffer <b> and reset pointers.
  */   */
 void  void
Line 185 
Line 174 
 }  }
   
 /*  /*
  * buf_putc()  
  *  
  * Append a single character <c> to the end of the buffer <b>.   * Append a single character <c> to the end of the buffer <b>.
  */   */
 void  void
Line 202 
Line 189 
 }  }
   
 /*  /*
  * buf_getc()  
  *  
  * Return u_char at buffer position <pos>.   * Return u_char at buffer position <pos>.
  *  
  */   */
 u_char  u_char
 buf_getc(BUF *b, size_t pos)  buf_getc(BUF *b, size_t pos)
Line 214 
Line 198 
 }  }
   
 /*  /*
  * buf_append()  
  *  
  * Append <len> bytes of data pointed to by <data> to the buffer <b>.  If the   * Append <len> bytes of data pointed to by <data> to the buffer <b>.  If the
  * buffer is too small to accept all data, it   * buffer is too small to accept all data, it will get resized to an
  * will get resized to an appropriate size to accept all data.   * appropriate size to accept all data.
  * Returns the number of bytes successfully appended to the buffer.   * Returns the number of bytes successfully appended to the buffer.
  */   */
 size_t  size_t
Line 239 
Line 221 
         return (rlen);          return (rlen);
 }  }
   
 /*  
  * buf_fappend()  
  *  
  */  
 size_t  size_t
 buf_fappend(BUF *b, const char *fmt, ...)  buf_fappend(BUF *b, const char *fmt, ...)
 {  {
Line 264 
Line 242 
 }  }
   
 /*  /*
  * buf_len()  
  *  
  * Returns the size of the buffer that is being used.   * Returns the size of the buffer that is being used.
  */   */
 size_t  size_t
Line 275 
Line 251 
 }  }
   
 /*  /*
  * buf_write_fd()  
  *  
  * Write the contents of the buffer <b> to the specified <fd>   * Write the contents of the buffer <b> to the specified <fd>
  */   */
 int  int
Line 305 
Line 279 
 }  }
   
 /*  /*
  * buf_write()  
  *  
  * Write the contents of the buffer <b> to the file whose path is given in   * Write the contents of the buffer <b> to the file whose path is given in
  * <path>.  If the file does not exist, it is created with mode <mode>.   * <path>.  If the file does not exist, it is created with mode <mode>.
  */   */
Line 336 
Line 308 
 }  }
   
 /*  /*
  * buf_write_stmp()  
  *  
  * Write the contents of the buffer <b> to a temporary file whose path is   * Write the contents of the buffer <b> to a temporary file whose path is
  * specified using <template> (see mkstemp.3). NB. This function will modify   * specified using <template> (see mkstemp.3).
  * <template>, as per mkstemp   * NB. This function will modify <template>, as per mkstemp
  */   */
 void  void
 buf_write_stmp(BUF *b, char *template)  buf_write_stmp(BUF *b, char *template)
Line 361 
Line 331 
 }  }
   
 /*  /*
  * buf_grow()  
  *  
  * Grow the buffer <b> by <len> bytes.  The contents are unchanged by this   * Grow the buffer <b> by <len> bytes.  The contents are unchanged by this
  * operation regardless of the result.   * operation regardless of the result.
  */   */

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