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

[PATCH] Remove use of global_pool to apr_xlate

From: Justin Erenkrantz <jerenkrantz_at_apache.org>
Date: 2002-11-08 05:19:13 CET

There might be some implications about opening multiple iconv streams
per process or thread, but I don't see anything that leads me to
believe that iconv is inherently thread-unsafe.

Philip, can you please try this patch out with your stress test? --
justin

* subversion/libsvn_subr/utf.c (get_ntou_xlate_handle,
get_uton_xlate_handle): No longer walk up the tree looking for
global_pool, but rather just use the passed-in pool.

Index: subversion/libsvn_subr/utf.c
===================================================================
--- subversion/libsvn_subr/utf.c (revision 3685)
+++ subversion/libsvn_subr/utf.c (working copy)
@@ -45,30 +45,17 @@
 get_ntou_xlate_handle (apr_xlate_t **ret, apr_pool_t *pool)
 {
   void *old_handle = NULL;
- apr_pool_t *parent, *global_pool;
   apr_status_t apr_err;

- /* ### I'm worried about the performance implications of searching
- * up the pool tree every time we call this function. Leaving it
in
- * for now, but if this turns out to be a bottleneck, then we
should
- * store the xlation handles in some more quickly accessible place.
- *
- * -kfogel, 7 July 2002
- */
- /* Find the global pool */
- for (global_pool = pool;
- (parent = apr_pool_get_parent (global_pool));
- global_pool = parent) ;
-
   /* If we already have a handle, just return it. */
- apr_pool_userdata_get (&old_handle, SVN_UTF_NTOU_XLATE_HANDLE,
global_pool);
+ apr_pool_userdata_get (&old_handle, SVN_UTF_NTOU_XLATE_HANDLE,
pool);
   if (old_handle != NULL) {
     *ret = old_handle;
     return SVN_NO_ERROR;
   }

   /* Try to create one. */
- apr_err = apr_xlate_open (ret, "UTF-8", APR_LOCALE_CHARSET,
global_pool);
+ apr_err = apr_xlate_open (ret, "UTF-8", APR_LOCALE_CHARSET, pool);

   if (APR_STATUS_IS_EINVAL (apr_err) || APR_STATUS_IS_ENOTIMPL
(apr_err))
     {
@@ -81,7 +68,7 @@

   /* Save it for later. */
   apr_pool_userdata_set (*ret, SVN_UTF_NTOU_XLATE_HANDLE,
- apr_pool_cleanup_null, global_pool);
+ apr_pool_cleanup_null, pool);

   return SVN_NO_ERROR;
 }
@@ -96,30 +83,17 @@
 get_uton_xlate_handle (apr_xlate_t **ret, apr_pool_t *pool)
 {
   void *old_handle = NULL;
- apr_pool_t *parent, *global_pool;
   apr_status_t apr_err;

- /* ### I'm worried about the performance implications of searching
- * up the pool tree every time we call this function. Leaving it
in
- * for now, but if this turns out to be a bottleneck, then we
should
- * store the xlation handles in some more quickly accessible place.
- *
- * -kfogel, 7 July 2002
- */
- /* Find the global pool */
- for (global_pool = pool;
- (parent = apr_pool_get_parent (global_pool));
- global_pool = parent) ;
-
   /* If we already have a handle, just return it. */
- apr_pool_userdata_get (&old_handle, SVN_UTF_UTON_XLATE_HANDLE,
global_pool);
+ apr_pool_userdata_get (&old_handle, SVN_UTF_UTON_XLATE_HANDLE,
pool);
   if (old_handle != NULL) {
     *ret = old_handle;
     return SVN_NO_ERROR;
   }

   /* Try to create one. */
- apr_err = apr_xlate_open (ret, APR_LOCALE_CHARSET, "UTF-8",
global_pool);
+ apr_err = apr_xlate_open (ret, APR_LOCALE_CHARSET, "UTF-8", pool);

   if (APR_STATUS_IS_EINVAL (apr_err) || APR_STATUS_IS_ENOTIMPL
(apr_err))
     {
@@ -132,7 +106,7 @@

   /* Save it for later. */
   apr_pool_userdata_set (*ret, SVN_UTF_UTON_XLATE_HANDLE,
- apr_pool_cleanup_null, global_pool);
+ apr_pool_cleanup_null, pool);

   return SVN_NO_ERROR;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Nov 8 05:18:58 2002

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.