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

Re: svn commit: r15343 - in trunk/subversion: libsvn_subr

From: Kouhei Sutou <kou_at_cozmixng.org>
Date: 2005-07-18 05:14:16 CEST

Hi,

Peter, very thanks for your feedback.

In <Pine.LNX.4.55.0507172309490.5175@localhost.localdomain>
  "Re: svn commit: r15343 - in trunk/subversion: libsvn_subr" on Sun, 17 Jul 2005 23:40:54 +0200 (CEST),
  "Peter N. Lundblad" <peter@famlundblad.se> wrote:

> > Extract NLS initialization code from svn_cmdline_init.
> >
> > * subversion/libsvn_subr/nls.c
> > (svn_nls_environment_init): Initialize NLS environment.
> > (svn_nls_init): Initialize NLS environment and set up
> > text domain.
> >
> These are new functions. YOu should say so in the log.

Is the following new log message OK?

[[[
Extract NLS initialization code from svn_cmdline_init.

* subversion/libsvn_subr/nls.c: New file.
  (svn_nls_environment_init): New function.
  Initialize NLS environment.
  (svn_nls_init): New function.
  Initialize NLS environment and set up text domain.

* subversion/include/svn_nls.h: New file.

...
]]]

> > Added: trunk/subversion/include/svn_nls.h
...

I attached the patch applied your many comments. Could you
check this?

> > +svn_error_t *svn_nls_environment_init (void);
...
> > +svn_error_t *svn_nls_init (void);
>
> OK. So why do we need both these functions? Becuase the last one also
> calls textdomain, which sets the default text domain to subversion. Does
> this one-liner really deserve a public API? AFAICT we're relying on the
> default text domain in two places in cmdline/cmdline (and I didn't find
> any place in the other cmdline programs we have). Can we change those two
> places from
> gettext(...)
> to
> dgettext(PACKGE_NAME, ...)
> we can stop using plain gettext and get rid of that textdomain() call.

It seems that getting rid of textdomain() is good idea.

I think the changes for doing this is just only replace
gettext(...) by _(...). Because _(...) macro is defined as
dgettext(PACKAGE_NAME, ...) in
subversion/svn_private_config.h{w,.in}.

Cheers,

--
kou

Index: subversion/include/svn_nls.h
===================================================================
--- subversion/include/svn_nls.h (revision 15353)
+++ subversion/include/svn_nls.h (working copy)
@@ -29,24 +29,28 @@
 #endif /* __cplusplus */
 
 /** Set up the NLS environment.
- * Return the error @c APR_EINVAL or APR_INCOMPLETE if an
+ * Return the error @c APR_EINVAL or @c APR_INCOMPLETE if an
  * error occurs.
  *
  * @note This function is for bindings. You should usually
- * use @c svn_cmdline_init() instead of calling this
+ * use svn_cmdline_init() instead of calling this
  * function directly. This function should be called
  * after initializing APR.
+ *
+ * @since New in 1.3.
  */
 svn_error_t *svn_nls_environment_init (void);
 
 /** Set up the NLS which includes NLS environment set up.
- * Return the error @c APR_EINVAL or APR_INCOMPLETE if an
+ * Return the error @c APR_EINVAL or @c APR_INCOMPLETE if an
  * error occurs.
  *
  * @note This function is for bindings. You should usually
- * use @c svn_cmdline_init() instead of calling this
+ * use svn_cmdline_init() instead of calling this
  * function directly. This function should be called
  * after initializing APR.
+ *
+ * @since New in 1.3.
  */
 svn_error_t *svn_nls_init (void);
 
Index: subversion/libsvn_subr/cmdline.c
===================================================================
--- subversion/libsvn_subr/cmdline.c (revision 15353)
+++ subversion/libsvn_subr/cmdline.c (working copy)
@@ -164,13 +164,13 @@
   svn_utf_initialize (pool);
   
   {
- svn_error_t *error = svn_nls_init();
- if (error)
+ svn_error_t *err = svn_nls_init();
+ if (err)
       {
- if (error_stream)
- fprintf(error_stream, "%s", error->message);
+ if (error_stream && err->message)
+ fprintf (error_stream, "%s", err->message);
         
- svn_error_clear(error);
+ svn_error_clear (err);
         return EXIT_FAILURE;
       }
   }
Index: subversion/libsvn_subr/nls.c
===================================================================
--- subversion/libsvn_subr/nls.c (revision 15353)
+++ subversion/libsvn_subr/nls.c (working copy)
@@ -36,7 +36,7 @@
 svn_error_t *
 svn_nls_environment_init (void)
 {
- svn_error_t *error = SVN_NO_ERROR;
+ svn_error_t *err = SVN_NO_ERROR;
   
 #ifdef ENABLE_NLS
 #ifdef WIN32
@@ -64,7 +64,7 @@
               MultiByteToWideChar (CP_ACP, 0, ansi_path, -1, ucs2_path,
                                    sizeof (ucs2_path) / sizeof (ucs2_path[0]));
             if (! inwords) {
- error =
+ err =
                 svn_error_createf(APR_EINVAL, NULL,
                                   _("Can't convert string to UCS-2: '%s'"),
                                   ansi_path);
@@ -72,12 +72,12 @@
           }
         else
           {
- error = svn_error_create(APR_EINVAL, NULL,
- _("Can't get module file name"));
+ err = svn_error_create(APR_EINVAL, NULL,
+ _("Can't get module file name"));
           }
       }
 
- if (error == SVN_NO_ERROR)
+ if (err == SVN_NO_ERROR)
       {
         outbytes = outlength = 3 * (inwords + 1);
         utf8_path = apr_palloc (pool, outlength);
@@ -87,10 +87,10 @@
           apr_err = APR_INCOMPLETE;
         if (apr_err)
           {
- error = svn_error_create(apr_err, NULL,
- _("Can't convert module path "
- "to UTF-8 from UCS-2: '%s'"),
- ucs2_path);
+ err = svn_error_create(apr_err, NULL,
+ _("Can't convert module path "
+ "to UTF-8 from UCS-2: '%s'"),
+ ucs2_path);
           }
         else
           {
@@ -114,7 +114,7 @@
 #endif
 #endif
 
- return error;
+ return err;
 }
 
 svn_error_t *

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jul 18 05:15:03 2005

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