eina: Improve eina_binbuf function documentation

Summary:
Define return values as part of @return.
Cleanup grammar.

Reviewers: devilhorns

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6503
This commit is contained in:
Bryce Harrington 2018-07-04 11:12:57 +09:00 committed by Hermet Park
parent b0e0fcf3d6
commit cc345edccd
1 changed files with 44 additions and 51 deletions

View File

@ -37,10 +37,10 @@ typedef struct _Eina_Strbuf Eina_Binbuf;
/** /**
* @brief Creates a new string buffer. * @brief Creates a new string buffer.
* *
* @return Newly allocated string buffer instance. * @return Newly allocated string buffer instance, or @c NULL on error.
* *
* This function creates a new string buffer. On error, @c NULL is * This function creates a new string buffer. To free the resources, use
* returned. To free the resources, use eina_binbuf_free(). * eina_binbuf_free().
* *
* @see eina_binbuf_free() * @see eina_binbuf_free()
* @see eina_binbuf_append() * @see eina_binbuf_append()
@ -55,10 +55,10 @@ EAPI Eina_Binbuf *eina_binbuf_new(void) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
* *
* @param str The string to manage. * @param str The string to manage.
* @param length The length of the string. * @param length The length of the string.
* @return Newly allocated string buffer instance. * @return Newly allocated string buffer instance, or @c NULL on error.
* *
* This function creates a new string buffer. On error, @c NULL is * This function creates a new string buffer. To free the resources, use
* returned. To free the resources, use eina_binbuf_free(). * eina_binbuf_free().
* *
* @see eina_binbuf_manage_new() * @see eina_binbuf_manage_new()
* @since 1.2.0 * @since 1.2.0
@ -73,14 +73,13 @@ EAPI Eina_Binbuf *eina_binbuf_manage_new_length(unsigned char *str, size_t lengt
* @param str The string to start from. * @param str The string to start from.
* @param length The length of the string. * @param length The length of the string.
* @param ro The passed string will not be touched if set to EINA_TRUE. * @param ro The passed string will not be touched if set to EINA_TRUE.
* @return Newly allocated string buffer instance. * @return Newly allocated string buffer instance, or @c NULL on error.
* *
* This function creates a new string buffer. On error, @c NULL is * This function creates a new string buffer. To free the resources, use
* returned. To free the resources, use eina_binbuf_free(). It will * eina_binbuf_free(). It will not touch the buffer if ro is set to @c
* not touch the buffer if ro is set to @c EINA_TRUE, but it will also not * EINA_TRUE, but it will also not copy it. If ro is set to @c EINA_TRUE
* copy it. If ro is set to @c EINA_TRUE any change operation will * any change operation will create a fresh new memory, copy old data
* create a fresh new memory, copy old data there and starting modifying * there and starting modifying that one.
* that one.
* *
* @see eina_binbuf_manage_new() * @see eina_binbuf_manage_new()
* @see eina_binbuf_manage_new_length() * @see eina_binbuf_manage_new_length()
@ -97,13 +96,12 @@ EAPI Eina_Binbuf *eina_binbuf_manage_new(const unsigned char *str, size_t length
* *
* @param str The string to start from. * @param str The string to start from.
* @param length The length of the string. * @param length The length of the string.
* @return Newly allocated string buffer instance. * @return Newly allocated string buffer instance, or @c NULL on error.
* *
* This function creates a new string buffer. On error, @c NULL is * This function creates a new string buffer. To free the resources, use
* returned. To free the resources, use eina_binbuf_free(). It will * eina_binbuf_free(). It will not touch the internal buffer. Any
* not touch the internal buffer. Any changing operation will * changing operation will create a fresh new memory, copy old data
* create a fresh new memory, copy old data there and starting modifying * there and starting modifying that one.
* that one.
* *
* @see eina_binbuf_manage_new() * @see eina_binbuf_manage_new()
* @since 1.9.0 * @since 1.9.0
@ -188,14 +186,13 @@ EAPI Eina_Bool eina_binbuf_use(Eina_Binbuf *buf, size_t extra_bytes) EINA_ARG_NO
* @param buf The string buffer to append to. * @param buf The string buffer to append to.
* @param str The string to append. * @param str The string to append.
* @param length The exact length to use. * @param length The exact length to use.
* @return #EINA_TRUE on success, #EINA_FALSE on failure. * @return #EINA_TRUE on success, #EINA_FALSE on failure such as if @p
* buf can't be appended.
* *
* This function appends @p str to @p buf. @p str must be of size at * This function appends @p str to @p buf. @p str must be of size at
* most @p length. It is slightly faster than eina_binbuf_append() as * most @p length. It is slightly faster than eina_binbuf_append() as
* it does not compute the size of @p str. It is useful when dealing * it does not compute the size of @p str. It is useful when dealing
* with strings of known size, such as eina_stringshare. If @p buf * with strings of known size, such as eina_stringshare.
* can't append it, #EINA_FALSE is returned, otherwise #EINA_TRUE is
* returned.
* *
* @see eina_stringshare_length() * @see eina_stringshare_length()
* @see eina_binbuf_append() * @see eina_binbuf_append()
@ -208,10 +205,10 @@ EAPI Eina_Bool eina_binbuf_append_length(Eina_Binbuf *buf, const unsigned char *
* *
* @param buf The string buffer to append to. * @param buf The string buffer to append to.
* @param slice The slice to append. * @param slice The slice to append.
* @return #EINA_TRUE on success, #EINA_FALSE on failure. * @return #EINA_TRUE on success, #EINA_FALSE on failure such as if
* @p buf can't be appended.
* *
* This function appends @p slice to @p buf. If @p buf can't append * This function appends @p slice to @p buf.
* it, #EINA_FALSE is returned, otherwise #EINA_TRUE is returned.
* *
* @since 1.19 * @since 1.19
*/ */
@ -222,12 +219,12 @@ EAPI Eina_Bool eina_binbuf_append_slice(Eina_Binbuf *buf, const Eina_Slice slice
* *
* @param buf The string buffer to append to. * @param buf The string buffer to append to.
* @param data The string buffer to append. * @param data The string buffer to append.
* @return #EINA_TRUE on success, #EINA_FALSE on failure. * @return #EINA_TRUE on success, #EINA_FALSE on failure such as if @p
* buf can't be appended.
* *
* This function appends @p data to @p buf. @p data must be allocated and * This function appends @p data to @p buf. @p data must be allocated and
* different from @c NULL. It is slightly faster than eina_binbuf_append() as * different from @c NULL. It is slightly faster than eina_binbuf_append() as
* it does not compute the size of @p str. If @p buf can't append it, * it does not compute the size of @p str.
* #EINA_FALSE is returned, otherwise #EINA_TRUE is returned.
* *
* @see eina_binbuf_append() * @see eina_binbuf_append()
* @see eina_binbuf_append_n() * @see eina_binbuf_append_n()
@ -242,10 +239,9 @@ EAPI Eina_Bool eina_binbuf_append_buffer(Eina_Binbuf *buf, const Eina_Binbuf *da
* *
* @param buf The string buffer to append to. * @param buf The string buffer to append to.
* @param c The char to append. * @param c The char to append.
* @return #EINA_TRUE on success, #EINA_FALSE on failure. * @return #EINA_TRUE on success, #EINA_FALSE if @pc could not be inserted.
* *
* This function inserts @p c to @p buf. If it can not insert it, #EINA_FALSE * This function inserts @p c to @p buf.
* is returned, otherwise #EINA_TRUE is returned.
*/ */
EAPI Eina_Bool eina_binbuf_append_char(Eina_Binbuf *buf, unsigned char c) EINA_ARG_NONNULL(1); EAPI Eina_Bool eina_binbuf_append_char(Eina_Binbuf *buf, unsigned char c) EINA_ARG_NONNULL(1);
@ -256,14 +252,12 @@ EAPI Eina_Bool eina_binbuf_append_char(Eina_Binbuf *buf, unsigned char c) EINA_A
* @param str The string to insert. * @param str The string to insert.
* @param length The exact length to use. * @param length The exact length to use.
* @param pos The position to insert the string. * @param pos The position to insert the string.
* @return #EINA_TRUE on success, #EINA_FALSE on failure. * @return #EINA_TRUE on success, #EINA_FALSE if @p str could not be inserted.
* *
* This function inserts @p str to @p buf. @p str must be of size at * This function inserts @p str to @p buf. @p str must be of size at
* most @p length. It is slightly faster than eina_binbuf_insert() as * most @p length. It is slightly faster than eina_binbuf_insert() as
* it does not compute the size of @p str. It is useful when dealing * it does not compute the size of @p str. It is useful when dealing
* with strings of known size, such as eina_stringshare. If @p buf * with strings of known size, such as eina_stringshare.
* can't insert it, #EINA_FALSE is returned, otherwise #EINA_TRUE is
* returned.
* *
* @see eina_stringshare_length() * @see eina_stringshare_length()
* @see eina_binbuf_insert() * @see eina_binbuf_insert()
@ -277,11 +271,9 @@ EAPI Eina_Bool eina_binbuf_insert_length(Eina_Binbuf *buf, const unsigned char *
* @param buf The string buffer to insert to. * @param buf The string buffer to insert to.
* @param slice The slice to insert. * @param slice The slice to insert.
* @param pos The position to insert the string. * @param pos The position to insert the string.
* @return #EINA_TRUE on success, #EINA_FALSE on failure. * @return #EINA_TRUE on success, #EINA_FALSE if @p slice could not be inserted.
* *
* This function inserts @p slice to @p buf at position @p pos. If @p * This function inserts @p slice to @p buf at position @p pos.
* buf can't insert it, #EINA_FALSE is returned, otherwise #EINA_TRUE
* is returned.
* *
* @since 1.19.0 * @since 1.19.0
*/ */
@ -294,11 +286,9 @@ EAPI Eina_Bool eina_binbuf_insert_slice(Eina_Binbuf *buf, const Eina_Slice slice
* @param buf The string buffer to insert to. * @param buf The string buffer to insert to.
* @param c The char to insert. * @param c The char to insert.
* @param pos The position to insert the char. * @param pos The position to insert the char.
* @return #EINA_TRUE on success, #EINA_FALSE on failure. * @return #EINA_TRUE on success, #EINA_FALSE if @p c could not be inserted.
* *
* This function inserts @p c to @p buf at position @p pos. If @p buf * This function inserts @p c to @p buf at position @p pos.
* can't append it, #EINA_FALSE is returned, otherwise #EINA_TRUE is
* returned.
*/ */
EAPI Eina_Bool eina_binbuf_insert_char(Eina_Binbuf *buf, unsigned char c, size_t pos) EINA_ARG_NONNULL(1); EAPI Eina_Bool eina_binbuf_insert_char(Eina_Binbuf *buf, unsigned char c, size_t pos) EINA_ARG_NONNULL(1);
@ -314,7 +304,7 @@ EAPI Eina_Bool eina_binbuf_insert_char(Eina_Binbuf *buf, unsigned char c, size_t
* *
* This function removes a slice of @p buf, starting at @p start * This function removes a slice of @p buf, starting at @p start
* (inclusive) and ending at @p end (non-inclusive). Both values are * (inclusive) and ending at @p end (non-inclusive). Both values are
* in bytes. It returns #EINA_FALSE on failure, #EINA_TRUE otherwise. * in bytes.
*/ */
EAPI Eina_Bool eina_binbuf_remove(Eina_Binbuf *buf, size_t start, size_t end) EINA_ARG_NONNULL(1); EAPI Eina_Bool eina_binbuf_remove(Eina_Binbuf *buf, size_t start, size_t end) EINA_ARG_NONNULL(1);
@ -323,12 +313,12 @@ EAPI Eina_Bool eina_binbuf_remove(Eina_Binbuf *buf, size_t start, size_t end) EI
* @brief Retrieves a pointer to the contents of a string buffer. * @brief Retrieves a pointer to the contents of a string buffer.
* *
* @param buf The string buffer. * @param buf The string buffer.
* @return The current string in the string buffer. * @return The string that is contained in @p buf.
* *
* This function returns the string contained in @p buf. The returned * This function returns the string contained in @p buf. The returned
* value must not be modified and will no longer be valid if @p buf is * value must not be modified and will no longer be valid if @p buf is
* modified. In other words, any eina_binbuf_append() or similar will * modified. In other words, any eina_binbuf_append() or similar will
* make that pointer invalid. * make the pointer invalid.
* *
* @see eina_binbuf_string_steal() * @see eina_binbuf_string_steal()
*/ */
@ -337,8 +327,8 @@ EAPI const unsigned char *eina_binbuf_string_get(const Eina_Binbuf *buf) EINA_AR
/** /**
* @brief Steals the contents of a string buffer. * @brief Steals the contents of a string buffer.
* *
* @param buf The string buffer to steal. * @param buf The string buffer.
* @return The current string in the string buffer. * @return The string that was contained in @p buf.
* *
* This function returns the string contained in @p buf. @p buf is * This function returns the string contained in @p buf. @p buf is
* then initialized and does not own the returned string anymore. The * then initialized and does not own the returned string anymore. The
@ -393,12 +383,15 @@ EAPI Eina_Slice eina_binbuf_slice_get(const Eina_Binbuf *buf) EINA_WARN_UNUSED_R
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_Rw_Slice eina_binbuf_rw_slice_get(const Eina_Binbuf *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); EAPI Eina_Rw_Slice eina_binbuf_rw_slice_get(const Eina_Binbuf *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
* @brief Gets the content of the buffer and free the buffer. * @brief Gets the content of the buffer and frees the buffer.
* *
* @param buf the buffer to get the content from and which will be freed * @param buf the buffer to get the content from and which will be freed
* *
* @return The content contained by buf. The caller must release the memory of the returned content by calling * @return The content contained by buf.
*
* The caller must release the memory of the returned content by calling
* free(). * free().
* *
* @since 1.19 * @since 1.19