Hi!
I hope I'm not asking too many stupid questions, but here's another one that
came up while reading Eina's buffer implementation. In e.g. the function
"eina_strbuf_common_new(size_t csize)", there is this undocumented parameter
"csize" that is passed to various other functions, too. This seems like the
size of the characters that are stored there by the code that uses this, is
that correct? I have created a patch in case it is.
Also, I noticed that the functions eina_strbuf_replace and
eina_strbuf_replace_all are possibly misplaced there. The problem is that they
use strstr() to search the given string, but this function and the strbuf
functions are ignorant of the character boundaries, i.e. above mentioned
character size. This means that this function must not be used with the
generic code in eina_binbuf_template_c.x, which it also isn't, but maybe the
two should be moved to eina_strbuf.c instead.
Uli
Index: src/lib/eina_strbuf_common.c
===================================================================
--- src/lib/eina_strbuf_common.c (revision 60201)
+++ src/lib/eina_strbuf_common.c (working copy)
@@ -76,6 +76,7 @@
* @internal
*
* init the buffer
+ * @param csize the character size
* @param buf the buffer to init
*
* @return #EINA_TRUE on success, #EINA_FALSE on failure.
@@ -102,6 +103,7 @@
* @internal
*
* resize the buffer
+ * @param csize the character size
* @param buf the buffer to resize
* @param size the minimum size of the buffer
*
@@ -151,6 +153,7 @@
*
* If required, enlarge the buffer to fit the new size.
*
+ * @param csize the character size
* @param buf the buffer to resize
* @param size the minimum size of the buffer
*
@@ -168,6 +171,7 @@
*
* insert string of known length at random within existing strbuf limits.
*
+ * @param csize the character size
* @param buf the buffer to resize, must be valid.
* @param str the string to copy, must be valid (!NULL and smaller than @a len)
* @param len the amount of bytes in @a str to copy, must be valid.
@@ -207,6 +211,7 @@
* @internal
* @brief Create a new string buffer.
*
+ * @param csize the character size
* @return Newly allocated string buffer instance.
*
* This function creates a new string buffer. On error, @c NULL is
@@ -257,6 +262,7 @@
* @internal
* @brief Reset a string buffer.
*
+ * @param csize the character size
* @param buf The string buffer to reset.
*
* This function reset @p buf: the buffer len is set to 0, and the
@@ -274,6 +280,7 @@
* @internal
* @brief Append a string to a buffer, reallocating as necessary.
*
+ * @param csize the character size
* @param buf The string buffer to append to.
* @param str The string to append.
* @return #EINA_TRUE on success, #EINA_FALSE on failure.
@@ -308,6 +315,7 @@
* @brief Append a string to a buffer, reallocating as necessary,
* limited by the given length.
*
+ * @param csize the character size
* @param buf The string buffer to append to.
* @param str The string to append.
* @param maxlen The maximum number of characters to append.
@@ -348,6 +356,7 @@
* @internal
* @brief Append a string of exact length to a buffer, reallocating as necessary.
*
+ * @param csize the character size
* @param buf The string buffer to append to.
* @param str The string to append.
* @param length The exact length to use.
@@ -385,6 +394,7 @@
* @internal
* @brief Insert a string to a buffer, reallocating as necessary.
*
+ * @param csize the character size
* @param buf The string buffer to insert.
* @param str The string to insert.
* @param pos The position to insert the string.
@@ -413,6 +423,7 @@
* @internal
* @brief Insert a string to a buffer, reallocating as necessary. Limited by maxlen.
*
+ * @param csize the character size
* @param buf The string buffer to insert to.
* @param str The string to insert.
* @param maxlen The maximum number of chars to insert.
@@ -448,6 +459,7 @@
* @internal
* @brief Insert a string of exact length to a buffer, reallocating as necessary.
*
+ * @param csize the character size
* @param buf The string buffer to insert to.
* @param str The string to insert.
* @param length The exact length to use.
@@ -484,6 +496,7 @@
* @brief Append a character to a string buffer, reallocating as
* necessary.
*
+ * @param csize the character size
* @param buf The string buffer to append to.
* @param c The char to append.
* @return #EINA_TRUE on success, #EINA_FALSE on failure.
@@ -507,6 +520,7 @@
* @brief Insert a character to a string buffer, reallocating as
* necessary.
*
+ * @param csize the character size
* @param buf The string buffer to insert to.
* @param c The char to insert.
* @param pos The position to insert the char.
@@ -531,6 +545,7 @@
* @internal
* @brief Remove a slice of the given string buffer.
*
+ * @param csize the character size
* @param buf The string buffer to remove a slice.
* @param start The initial (inclusive) slice position to start
* removing, in bytes.
@@ -592,6 +607,7 @@
* @internal
* @brief Steal the contents of a string buffer.
*
+ * @param csize the character size
* @param buf The string buffer to steal.
* @return The current string in the string buffer.
*
@@ -617,6 +633,7 @@
* @internal
* @brief Free the contents of a string buffer but not the buffer.
*
+ * @param csize the character size
* @param buf The string buffer to free the string of.
*
* This function frees the string contained in @p buf without freeing
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel