Awful name! Maybe replace_stringshared()? On Friday, February 1, 2013, Enlightenment SVN wrote:
> Log: > add eina_stringshare_refplace(): same as replace(), but calls ref instead > of add > also fixed a small doc error > > > Author: discomfitor > Date: 2013-02-01 03:12:33 -0800 (Fri, 01 Feb 2013) > New Revision: 83549 > Trac: http://trac.enlightenment.org/e/changeset/83549 > > Modified: > trunk/efl/ChangeLog trunk/efl/NEWS > trunk/efl/src/lib/eina/eina_inline_stringshare.x > > Modified: trunk/efl/ChangeLog > =================================================================== > --- trunk/efl/ChangeLog 2013-02-01 11:05:38 UTC (rev 83548) > +++ trunk/efl/ChangeLog 2013-02-01 11:12:33 UTC (rev 83549) > @@ -1,6 +1,7 @@ > 2013-02-01 Mike Blumenkrantz > > * added eet_data_descriptor_name_get() > + * added eina_stringshare_refplace() > > 2013-01-31 Guillaume Friloux > > > Modified: trunk/efl/NEWS > =================================================================== > --- trunk/efl/NEWS 2013-02-01 11:05:38 UTC (rev 83548) > +++ trunk/efl/NEWS 2013-02-01 11:12:33 UTC (rev 83549) > @@ -48,6 +48,7 @@ > * 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() > > Modified: trunk/efl/src/lib/eina/eina_inline_stringshare.x > =================================================================== > --- trunk/efl/src/lib/eina/eina_inline_stringshare.x 2013-02-01 > 11:05:38 UTC (rev 83548) > +++ trunk/efl/src/lib/eina/eina_inline_stringshare.x 2013-02-01 > 11:12:33 UTC (rev 83549) > @@ -28,9 +28,41 @@ > */ > > /** > + * 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 @@ > /** > * 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. > * > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_jan > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net <javascript:;> > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: barbi...@gmail.com Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_jan _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel