Hi Stephan,
On Tue, 01 Oct 2013 18:13:39 +0200
Stephan Bergmann sberg...@redhat.com wrote:
On 10/01/2013 05:05 PM, Matteo Casalin wrote:
OUString provides the metod replace(sal_Unicode, sal_Unicode), which
seems to be not widely used, while there are for sure some replaceAll(a,
b) calls here and there.
Would it be fine to rename the former to replaceAll(sal_Unicode,
sal_Unicode) for consistency, fix the current calls and then slowly convert
all of the call-places of the latter (which I think to be be less
efficient)?
If any backward compatibility is needed, replace could be kept and just
call the related replaceAll.
Not too sure that would really be worth it:
* Single-character replacement is different from multi-character
replacement in that it doesn't need to specify how to handle cases where
one replacement gives rise to further replacement opportunities.
(That's why there originally only was a replaceFirst for the
multi-character case, to avoid having to make a decision.)
* There is no support for fromIndex in replace.
* replace is an inline function, so it could be replaced (no pun
intended) with only becoming build-time, not runtime incompatible.
Keeping it around and having two inline functions doing the same trivial
thing to avoid that looks like a bit too much overhead to me.
* The underlying C function is called rtl_uString_newReplace, not
..._rewReplaceAll (and /that/ couldn't be changed without breaking ABI).
Stephan
Your rationale really overcomes my simple it changes All of the occurrences :)
I will reduce the task to just not introducing any new replaceAll(a, b) and
by replacing the existing ones with replace('a', 'b'), when I find any.
Many thanks for the quick and detailed reply!
Matteo
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice