forked from enlightenment/efl
add eina_stringshare_refplace(): same as replace(), but calls ref instead of add
also fixed a small doc error SVN revision: 83549
This commit is contained in:
parent
bfc76668f4
commit
1f9a84b9cc
|
@ -1,6 +1,7 @@
|
|||
2013-02-01 Mike Blumenkrantz
|
||||
|
||||
* added eet_data_descriptor_name_get()
|
||||
* added eina_stringshare_refplace()
|
||||
|
||||
2013-01-31 Guillaume Friloux
|
||||
|
||||
|
|
1
NEWS
1
NEWS
|
@ -48,6 +48,7 @@ Additions:
|
|||
* Added eina_xattr_fd_get(), eina_xattr_fd_set(),
|
||||
eina_xattr_del(), eina_xattr_fd_del(), eina_xattr_copy() and
|
||||
eina_xattr_fd_copy()
|
||||
* added eina_stringshare_refplace()
|
||||
* Added eina_file_copy()
|
||||
* Add eet_mmap.
|
||||
* added eet_data_descriptor_name_get()
|
||||
|
|
|
@ -27,10 +27,42 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Replace the previously stringshared pointer with another stringshared pointer.
|
||||
*
|
||||
* The string pointed by @a p_str must be previously stringshared or
|
||||
* @c NULL and it will be eina_stringshare_del(). The new string must also
|
||||
* be stringshared and will be passed to eina_stringshare_ref() and then assigned to @c *p_str.
|
||||
* This function is identical to eina_stringshare_replace() except that it calls
|
||||
* eina_stringshare_ref() instead of eina_stringshare_del()
|
||||
*
|
||||
* @param p_str pointer to the stringhare to be replaced. Must not be
|
||||
* @c NULL, but @c *p_str may be @c NULL as it is a valid
|
||||
* stringshare handle.
|
||||
* @param news new string to replace with, may be @c NULL.
|
||||
*
|
||||
* @return #EINA_TRUE if the strings were different and thus replaced, #EINA_FALSE
|
||||
* if the strings were the same after shared.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
static inline Eina_Bool
|
||||
eina_stringshare_refplace(Eina_Stringshare **p_str, Eina_Stringshare *news)
|
||||
{
|
||||
if (*p_str == news) return EINA_FALSE;
|
||||
|
||||
news = eina_stringshare_ref(news);
|
||||
eina_stringshare_del(*p_str);
|
||||
if (*p_str == news)
|
||||
return EINA_FALSE;
|
||||
*p_str = news;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the previously stringshared pointer with new content.
|
||||
*
|
||||
* The string pointed by @a p_str should be previously stringshared or
|
||||
* The string pointed by @a p_str must be previously stringshared or
|
||||
* @c NULL and it will be eina_stringshare_del(). The new string will
|
||||
* be passed to eina_stringshare_add() and then assigned to @c *p_str.
|
||||
*
|
||||
|
@ -58,7 +90,7 @@ eina_stringshare_replace(Eina_Stringshare **p_str, const char *news)
|
|||
/**
|
||||
* Replace the previously stringshared pointer with a new content.
|
||||
*
|
||||
* The string pointed by @a p_str should be previously stringshared or
|
||||
* The string pointed by @a p_str must be previously stringshared or
|
||||
* @c NULL and it will be eina_stringshare_del(). The new string will
|
||||
* be passed to eina_stringshare_add_length() and then assigned to @c *p_str.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue