[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r36334 - trunk/subversion/libsvn_subr

From: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 5 Mar 2009 00:55:14 +0000

On Wed, Mar 04, 2009 at 03:43:55PM -0800, Bert Huijben wrote:
> Author: rhuijben
> Date: Wed Mar 4 15:43:55 2009
> New Revision: 36334
>
> Log:
> * subversion/libsvn_subr/utf.c
> (svn_utf_cstring_to_utf8, svn_utf_cstring_from_utf8):
> On platforms where the apr internal character set is always UTF-8,
> just copy the data instead of attempting to convert it. On converting
> to utf-8 keep the validation step for compatibility reasons.
> (This optimization applies to Windows and Mac OS).
>
> On Windows this avoids initializing COM in our process for only
> doing simple things like parsing the passed pathnames.

Is there some platform-independent way to test for this?
Something like APR_INTERNAL_CHARSET_IS_ALWAYS_UTF8?
If such a mechanism is not yet provided by APR, shouldn't
we ask them to add it?

Stefan
 
> Modified:
> trunk/subversion/libsvn_subr/utf.c
>
> Modified: trunk/subversion/libsvn_subr/utf.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/utf.c?pathrev=36334&r1=36333&r2=36334
> ==============================================================================
> --- trunk/subversion/libsvn_subr/utf.c Wed Mar 4 14:57:55 2009 (r36333)
> +++ trunk/subversion/libsvn_subr/utf.c Wed Mar 4 15:43:55 2009 (r36334)
> @@ -716,6 +716,10 @@ svn_utf_cstring_to_utf8(const char **des
> const char *src,
> apr_pool_t *pool)
> {
> +#if defined(WIN32) || defined(DARWIN)
> + /* Apr internal charset is always UTF-8 */
> + *dest = apr_pstrdup(pool, src);
> +#else
> xlate_handle_node_t *node;
> svn_error_t *err;
>
> @@ -723,6 +727,7 @@ svn_utf_cstring_to_utf8(const char **des
> err = convert_cstring(dest, src, node, pool);
> put_xlate_handle_node(node, SVN_UTF_NTOU_XLATE_HANDLE, pool);
> SVN_ERR(err);
> +#endif
> return check_cstring_utf8(*dest, pool);
> }
>
> @@ -825,6 +830,11 @@ svn_utf_cstring_from_utf8(const char **d
> const char *src,
> apr_pool_t *pool)
> {
> +#if defined(WIN32) || defined(DARWIN)
> + /* Apr internal charset is always UTF-8 */
> + *dest = apr_pstrdup(pool, src);
> + return SVN_NO_ERROR;
> +#else
> xlate_handle_node_t *node;
> svn_error_t *err;
>
> @@ -835,6 +845,7 @@ svn_utf_cstring_from_utf8(const char **d
> put_xlate_handle_node(node, SVN_UTF_UTON_XLATE_HANDLE, pool);
>
> return err;
> +#endif
> }
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=1269194
Received on 2009-03-05 01:55:36 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.