summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2014-01-02 12:16:26 +0900
committerCedric BAIL <cedric.bail@samsung.com>2014-01-20 13:04:07 +0900
commit342dd72e37dc2186f47357cc1102901ee903daaa (patch)
tree9f9fde286c6163c930146c2c27215965d41944df /src
parent00d4f5cf1c3e4d950fc7adc12c3e8229b2af99d1 (diff)
eina: add eina_binbuf_append_buffer() and eina_strbuf_append_buffer().
Diffstat (limited to 'src')
-rw-r--r--src/lib/eina/eina_binbuf.h18
-rw-r--r--src/lib/eina/eina_binbuf_template_c.x9
-rw-r--r--src/lib/eina/eina_strbuf.h18
3 files changed, 45 insertions, 0 deletions
diff --git a/src/lib/eina/eina_binbuf.h b/src/lib/eina/eina_binbuf.h
index c0a2069bc6..f887b9b811 100644
--- a/src/lib/eina/eina_binbuf.h
+++ b/src/lib/eina/eina_binbuf.h
@@ -106,6 +106,24 @@ EAPI void eina_binbuf_reset(Eina_Binbuf *buf) EINA_ARG_NONNULL(1);
106EAPI Eina_Bool eina_binbuf_append_length(Eina_Binbuf *buf, const unsigned char *str, size_t length) EINA_ARG_NONNULL(1, 2); 106EAPI Eina_Bool eina_binbuf_append_length(Eina_Binbuf *buf, const unsigned char *str, size_t length) EINA_ARG_NONNULL(1, 2);
107 107
108/** 108/**
109 * @brief Append an Eina_Binbuf to a buffer, reallocating as necessary.
110 *
111 * @param buf The string buffer to append to.
112 * @param data The string buffer to append.
113 * @return #EINA_TRUE on success, #EINA_FALSE on failure.
114 *
115 * This function appends @p data to @p buf. @p data must be allocated and
116 * different from @NULL. It is slightly faster than eina_binbuf_append() as
117 * it does not compute the size of @p str. If @p buf can't append it,
118 * #EINA_FALSE is returned, otherwise #EINA_TRUE is returned.
119 *
120 * @see eina_binbuf_append()
121 * @see eina_binbuf_append_n()
122 * @see eina_binbuf_append_length()
123 */
124EAPI Eina_Bool eina_binbuf_append_buffer(Eina_Binbuf *buf, const Eina_Binbuf *data) EINA_ARG_NONNULL(1, 2);
125
126/**
109 * @brief Append a character to a string buffer, reallocating as 127 * @brief Append a character to a string buffer, reallocating as
110 * necessary. 128 * necessary.
111 * 129 *
diff --git a/src/lib/eina/eina_binbuf_template_c.x b/src/lib/eina/eina_binbuf_template_c.x
index 3dfae42b0e..84541cf746 100644
--- a/src/lib/eina/eina_binbuf_template_c.x
+++ b/src/lib/eina/eina_binbuf_template_c.x
@@ -99,6 +99,15 @@ _FUNC_EXPAND(append_length)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_DATA_TYPE *s
99} 99}
100 100
101EAPI Eina_Bool 101EAPI Eina_Bool
102_FUNC_EXPAND(append_buffer)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_STRUCT_NAME *data)
103{
104 EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
105 EINA_MAGIC_CHECK_STRBUF(data, EINA_FALSE);
106
107 return eina_strbuf_common_append_length(_STRBUF_CSIZE, buf, (_STRBUF_DATA_TYPE *) eina_strbuf_common_string_get(data), eina_strbuf_common_length_get(data));
108}
109
110EAPI Eina_Bool
102_FUNC_EXPAND(insert_length)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_DATA_TYPE *str, size_t length, size_t pos) 111_FUNC_EXPAND(insert_length)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_DATA_TYPE *str, size_t length, size_t pos)
103{ 112{
104 EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); 113 EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
diff --git a/src/lib/eina/eina_strbuf.h b/src/lib/eina/eina_strbuf.h
index e7f25b97f5..45e0bd355d 100644
--- a/src/lib/eina/eina_strbuf.h
+++ b/src/lib/eina/eina_strbuf.h
@@ -209,6 +209,24 @@ EAPI Eina_Bool eina_strbuf_append_n(Eina_Strbuf *buf, const char *str, size_t ma
209EAPI Eina_Bool eina_strbuf_append_length(Eina_Strbuf *buf, const char *str, size_t length) EINA_ARG_NONNULL(1, 2); 209EAPI Eina_Bool eina_strbuf_append_length(Eina_Strbuf *buf, const char *str, size_t length) EINA_ARG_NONNULL(1, 2);
210 210
211/** 211/**
212 * @brief Append an Eina_Strbuf to a buffer, reallocating as necessary.
213 *
214 * @param buf The string buffer to append to.
215 * @param data The string buffer to append.
216 * @return #EINA_TRUE on success, #EINA_FALSE on failure.
217 *
218 * This function appends @p data to @p buf. @p data must be allocated and
219 * different from @NULL. It is slightly faster than eina_strbuf_append() as
220 * it does not compute the size of @p str. If @p buf can't append it,
221 * #EINA_FALSE is returned, otherwise #EINA_TRUE is returned.
222 *
223 * @see eina_strbuf_append()
224 * @see eina_strbuf_append_n()
225 * @see eina_strbuf_append_length()
226 */
227EAPI Eina_Bool eina_strbuf_append_buffer(Eina_Strbuf *buf, const Eina_Strbuf *data) EINA_ARG_NONNULL(1, 2);
228
229/**
212 * @brief Append a character to a string buffer, reallocating as 230 * @brief Append a character to a string buffer, reallocating as
213 * necessary. 231 * necessary.
214 * 232 *