forked from enlightenment/efl
Add eina_strbuf_append_escaped for edje
SVN revision: 45950
This commit is contained in:
parent
72fccca0eb
commit
522a0ab1ab
|
@ -10,6 +10,7 @@ typedef struct _Eina_Strbuf Eina_Strbuf;
|
|||
EAPI Eina_Strbuf *eina_strbuf_new(void);
|
||||
EAPI void eina_strbuf_free(Eina_Strbuf *buf) EINA_ARG_NONNULL(1);
|
||||
EAPI void eina_strbuf_append(Eina_Strbuf *buf, const char *str) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI void eina_strbuf_append_escaped(Eina_Strbuf *buf, const char *str) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI void eina_strbuf_append_n(Eina_Strbuf *buf, const char *str, unsigned int maxlen) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI void eina_strbuf_append_char(Eina_Strbuf *buf, char c) EINA_ARG_NONNULL(1);
|
||||
EAPI void eina_strbuf_insert(Eina_Strbuf *buf, const char *str,
|
||||
|
|
|
@ -102,6 +102,26 @@ eina_strbuf_append(Eina_Strbuf *buf, const char *str)
|
|||
buf->len += len;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append an escaped string to a buffer, reallocating as necessary.
|
||||
* @param buf the Eina_Strbuf to append to
|
||||
* @param str the string to append
|
||||
*/
|
||||
EAPI void
|
||||
eina_strbuf_append_escaped(Eina_Strbuf *buf, const char *str)
|
||||
{
|
||||
size_t len;
|
||||
char *esc;
|
||||
EINA_MAGIC_CHECK_STRBUF(buf);
|
||||
|
||||
esc = eina_str_escape(str);
|
||||
len = strlen(str);
|
||||
_eina_strbuf_resize(buf, buf->len + len);
|
||||
eina_strlcpy(buf->buf + buf->len, str, buf->size - buf->len);
|
||||
buf->len += len;
|
||||
free(esc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a string to a buffer, reallocating as necessary. Limited by maxlen.
|
||||
* @param buf the Eina_Strbuf to append to
|
||||
|
|
Loading…
Reference in New Issue