diff --git a/include/ucore/dbuf.h b/include/ucore/dbuf.h index 4aa71ab..c3c841c 100644 --- a/include/ucore/dbuf.h +++ b/include/ucore/dbuf.h @@ -20,6 +20,7 @@ extern "C" { * to indicate you're done with the data. * * typically(but add error checking) + * @code * DBuf buf; * dbuf_init(&buf,4096); * for(;;) { @@ -34,27 +35,30 @@ extern "C" { * dbuf_take(&dbuf,linelen); * } * } + * @endcode */ typedef struct DBuf DBuf; struct DBuf { /** Start of user data */ unsigned char *start; - /** end of user data */ + /** End of user data */ unsigned char *end; /** Start of underlying buffer. Internal use.*/ unsigned char *bufstart; - /** end of underlying buffer. Internal use.*/ + /** End of underlying buffer. Internal use.*/ 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 + * * @param buf buffer to free */ void uc_dbuf_free(DBuf *buf); -/** Initialixe a dbuf. +/** Initialize a dbuf. * * @param buf buffer to initialize +* @param initlen inital capacity of the buffer * @return 0 on success */ 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 * - * @buf buffer to get allocated length of + * @param buf buffer to get allocated length of * @return allocated length of the underlying buffer */ size_t uc_dbuf_buflen(DBuf *buf); /** Get remaining space in the buffer + * * @param buf 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, * - * @param buffer + * @param buf buffer * @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); -/** 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 */ void uc_dbuf_trim(DBuf *buf); @@ -99,12 +105,12 @@ void uc_dbuf_trim(DBuf *buf); * * @param buf 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); -/** indicate you've added 'len' bytes to the buffer - * Advances buf->end by @len bytes +/** Indicate you've added 'len' bytes to the buffer + * Advances buf->end by len bytes * User must always make sure (e.g. by using uc_dbuf_ensure) * that the buffer has the capacity to add @len bytes *