+eina_strbuf_string_free to free string in strbuf without freeing strbuf

SVN revision: 50316
This commit is contained in:
Mike Blumenkrantz 2010-07-18 06:21:50 +00:00
parent d3982d4b5c
commit 9276378041
2 changed files with 21 additions and 1 deletions

View File

@ -147,6 +147,7 @@ EAPI Eina_Bool eina_strbuf_insert_vprintf(Eina_Strbuf *buf, const char *fmt, siz
EAPI Eina_Bool eina_strbuf_remove(Eina_Strbuf *buf, size_t start, size_t end) EINA_ARG_NONNULL(1);
EAPI const char *eina_strbuf_string_get(const Eina_Strbuf *buf) EINA_ARG_NONNULL(1);
EAPI char *eina_strbuf_string_steal(Eina_Strbuf *buf) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
EAPI void eina_strbuf_string_free(Eina_Strbuf *buf) EINA_MALLOC EINA_ARG_NONNULL(1);
EAPI size_t eina_strbuf_length_get(const Eina_Strbuf *buf) EINA_ARG_NONNULL(1);
EAPI Eina_Bool eina_strbuf_replace(Eina_Strbuf *buf, const char *str, const char *with, unsigned int n) EINA_ARG_NONNULL(1, 2, 3);

View File

@ -825,7 +825,7 @@ eina_strbuf_string_get(const Eina_Strbuf *buf)
* @return The current string in the string buffer.
*
* This function returns the string contained in @p buf. @p buf is
* then initialized and does not own anymore the returned string. The
* then initialized and does not own the returned string anymore. The
* caller must release the memory of the returned string by calling
* free().
*
@ -844,6 +844,25 @@ eina_strbuf_string_steal(Eina_Strbuf *buf)
return ret;
}
/**
* @brief Free the contents of a string buffer but not the buffer.
*
* @param buf The string buffer to free the string of.
*
* This function frees the string contained in @p buf without freeing
* @p buf.
*/
EAPI void
eina_strbuf_string_free(Eina_Strbuf *buf)
{
char *ret;
EINA_MAGIC_CHECK_STRBUF(buf, NULL);
free(buf->buf);
_eina_strbuf_init(buf);
}
/**
* @brief Retrieve the length of the string buffer content.
*