Correct spelling mistakes in comments
This commit is contained in:
+17
-11
@@ -20,6 +20,7 @@ extern "C" {
|
|||||||
* to indicate you're done with the data.
|
* to indicate you're done with the data.
|
||||||
*
|
*
|
||||||
* typically(but add error checking)
|
* typically(but add error checking)
|
||||||
|
* @code
|
||||||
* DBuf buf;
|
* DBuf buf;
|
||||||
* dbuf_init(&buf,4096);
|
* dbuf_init(&buf,4096);
|
||||||
* for(;;) {
|
* for(;;) {
|
||||||
@@ -34,27 +35,30 @@ extern "C" {
|
|||||||
* dbuf_take(&dbuf,linelen);
|
* dbuf_take(&dbuf,linelen);
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
|
* @endcode
|
||||||
*/
|
*/
|
||||||
typedef struct DBuf DBuf;
|
typedef struct DBuf DBuf;
|
||||||
struct DBuf {
|
struct DBuf {
|
||||||
/** Start of user data */
|
/** Start of user data */
|
||||||
unsigned char *start;
|
unsigned char *start;
|
||||||
/** end of user data */
|
/** End of user data */
|
||||||
unsigned char *end;
|
unsigned char *end;
|
||||||
/** Start of underlying buffer. Internal use.*/
|
/** Start of underlying buffer. Internal use.*/
|
||||||
unsigned char *bufstart;
|
unsigned char *bufstart;
|
||||||
/** end of underlying buffer. Internal use.*/
|
/** End of underlying buffer. Internal use.*/
|
||||||
unsigned char *bufend;
|
unsigned char *bufend;
|
||||||
};
|
};
|
||||||
/** free the internals of a DBuf, does not free buf itself.
|
/** Free the internals of a DBuf, does not free buf itself.
|
||||||
* Does nothing if buf == NULL
|
* Does nothing if buf == NULL
|
||||||
|
*
|
||||||
* @param buf buffer to free
|
* @param buf buffer to free
|
||||||
*/
|
*/
|
||||||
void uc_dbuf_free(DBuf *buf);
|
void uc_dbuf_free(DBuf *buf);
|
||||||
|
|
||||||
/** Initialixe a dbuf.
|
/** Initialize a dbuf.
|
||||||
*
|
*
|
||||||
* @param buf buffer to initialize
|
* @param buf buffer to initialize
|
||||||
|
* @param initlen inital capacity of the buffer
|
||||||
* @return 0 on success
|
* @return 0 on success
|
||||||
*/
|
*/
|
||||||
int uc_dbuf_init(DBuf *buf,size_t initlen);
|
int uc_dbuf_init(DBuf *buf,size_t initlen);
|
||||||
@@ -68,12 +72,13 @@ size_t uc_dbuf_len(DBuf *buf);
|
|||||||
|
|
||||||
/** Allocated size of the buffer
|
/** Allocated size of the buffer
|
||||||
*
|
*
|
||||||
* @buf buffer to get allocated length of
|
* @param buf buffer to get allocated length of
|
||||||
* @return allocated length of the underlying buffer
|
* @return allocated length of the underlying buffer
|
||||||
*/
|
*/
|
||||||
size_t uc_dbuf_buflen(DBuf *buf);
|
size_t uc_dbuf_buflen(DBuf *buf);
|
||||||
|
|
||||||
/** Get remaining space in the buffer
|
/** Get remaining space in the buffer
|
||||||
|
*
|
||||||
* @param buf buffer
|
* @param buf buffer
|
||||||
* @return remaining space (after buf->end) in the buffer
|
* @return remaining space (after buf->end) in the buffer
|
||||||
*/
|
*/
|
||||||
@@ -81,13 +86,14 @@ size_t uc_dbuf_remaining(DBuf *buf);
|
|||||||
|
|
||||||
/** ensure the buffer can hold 'capacity' no of bytes,
|
/** ensure the buffer can hold 'capacity' no of bytes,
|
||||||
*
|
*
|
||||||
* @param buffer
|
* @param buf buffer
|
||||||
* @param capacity ensure there is room for capacity bytes after buf->end
|
* @param capacity ensure there is room for capacity bytes after buf->end
|
||||||
* @retun 0 on success
|
* @return 0 on success
|
||||||
*/
|
*/
|
||||||
int uc_dbuf_ensure(DBuf *buf,size_t capacity);
|
int uc_dbuf_ensure(DBuf *buf,size_t capacity);
|
||||||
|
|
||||||
/** trim the buffer to hold no more space than needed.
|
/** Trim the buffer to hold no more space than needed.
|
||||||
|
*
|
||||||
* @param buf buffer to trum
|
* @param buf buffer to trum
|
||||||
*/
|
*/
|
||||||
void uc_dbuf_trim(DBuf *buf);
|
void uc_dbuf_trim(DBuf *buf);
|
||||||
@@ -99,12 +105,12 @@ void uc_dbuf_trim(DBuf *buf);
|
|||||||
*
|
*
|
||||||
* @param buf buffer
|
* @param buf buffer
|
||||||
* @param len length that was taken out of the buffer
|
* @param len length that was taken out of the buffer
|
||||||
* @return 0 on success. Non-zero if @len is larger than the bufer capacity
|
* @return 0 on success. Non-zero if len is larger than the bufer capacity
|
||||||
*/
|
*/
|
||||||
int uc_dbuf_take(DBuf *buf,size_t len);
|
int uc_dbuf_take(DBuf *buf,size_t len);
|
||||||
|
|
||||||
/** indicate you've added 'len' bytes to the buffer
|
/** Indicate you've added 'len' bytes to the buffer
|
||||||
* Advances buf->end by @len bytes
|
* Advances buf->end by len bytes
|
||||||
* User must always make sure (e.g. by using uc_dbuf_ensure)
|
* User must always make sure (e.g. by using uc_dbuf_ensure)
|
||||||
* that the buffer has the capacity to add @len bytes
|
* that the buffer has the capacity to add @len bytes
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user