Re: [Bug-wget] [PATCH] Fix for #43785

2015-02-07 Thread Giuseppe Scrivano
Tim Ruehsen tim.rueh...@gmx.de writes:

 Fix #43785 for another Solaris issue.

 I would like to see this in the next bugfix release.

 Do you agree ?

 Tim

 From 518ed8d07c0a6e441e0a919ba1967d89e0061898 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Tim=20R=C3=BChsen?= tim.rueh...@gmx.de
 Date: Thu, 5 Feb 2015 16:05:24 +0100
 Subject: [PATCH] src/wget.h: Fix libintl.h / gettext clash for Solaris

 In case --disable-nls is given, we have to include libintl.h before
 out gettext defines because libintl.h will be implicitly included by
 locale.h. And in this case our defines will conflict with libintl.h
 function prototypes.
 ---
  src/wget.h | 11 +++
  1 file changed, 7 insertions(+), 4 deletions(-)

 diff --git a/src/wget.h b/src/wget.h
 index cddacdc..0b2381d 100644
 --- a/src/wget.h
 +++ b/src/wget.h
 @@ -59,11 +59,14 @@ as that of the covered work.  */
  /* `gettext (FOO)' is long to write, so we use `_(FOO)'.  If NLS is
 unavailable, _(STRING) simply returns STRING.  */
  #if ENABLE_NLS
 -#include libintl.h
 -#define _(STRING) gettext(STRING)
 +# include libintl.h
 +# define _(STRING) gettext(STRING)
  #else
 -#define _(STRING) STRING
 -#define ngettext(STRING1,STRING2,N) STRING2
 +# ifdef solaris
 +#  include libintl.h
 +# endif

I would prefer that we don't have OS dependent ifdefs.  What about
redefining ngettext as following when !ENABLE_NLS?  Would this be
enough?

# define ngettext(Msgid1, Msgid2, N) \
((N) == 1 \
 ? ((void) (Msgid2), (const char *) (Msgid1)) \
 : ((void) (Msgid1), (const char *) (Msgid2)))

Or can't we just #include libintl.h on all platforms?

Regards,
Giuseppe



Re: [Bug-wget] [PATCH] Fix for #43785

2015-02-07 Thread Tim Rühsen
Am Samstag, 7. Februar 2015, 10:14:33 schrieb Giuseppe Scrivano:
 Tim Ruehsen tim.rueh...@gmx.de writes:
  Fix #43785 for another Solaris issue.
  
  I would like to see this in the next bugfix release.
  
  Do you agree ?
  
  Tim
  
  From 518ed8d07c0a6e441e0a919ba1967d89e0061898 Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?Tim=20R=C3=BChsen?= tim.rueh...@gmx.de
  Date: Thu, 5 Feb 2015 16:05:24 +0100
  Subject: [PATCH] src/wget.h: Fix libintl.h / gettext clash for Solaris
  
  In case --disable-nls is given, we have to include libintl.h before
  out gettext defines because libintl.h will be implicitly included by
  locale.h. And in this case our defines will conflict with libintl.h
  function prototypes.
  ---
  
   src/wget.h | 11 +++
   1 file changed, 7 insertions(+), 4 deletions(-)
  
  diff --git a/src/wget.h b/src/wget.h
  index cddacdc..0b2381d 100644
  --- a/src/wget.h
  +++ b/src/wget.h
  @@ -59,11 +59,14 @@ as that of the covered work.  */
  
   /* `gettext (FOO)' is long to write, so we use `_(FOO)'.  If NLS is
   
  unavailable, _(STRING) simply returns STRING.  */
   
   #if ENABLE_NLS
  
  -#  include libintl.h
  -#  define _(STRING) gettext(STRING)
  +# include libintl.h
  +# define _(STRING) gettext(STRING)
  
   #else
  
  -#  define _(STRING) STRING
  -#  define ngettext(STRING1,STRING2,N) STRING2
  +# ifdef solaris
  +#  include libintl.h
  +# endif
 
 I would prefer that we don't have OS dependent ifdefs.  What about
 redefining ngettext as following when !ENABLE_NLS?  Would this be
 enough?
 
 # define ngettext(Msgid1, Msgid2, N) \
 ((N) == 1 \
  ? ((void) (Msgid2), (const char *) (Msgid1)) \
 
  : ((void) (Msgid1), (const char *) (Msgid2)))

This does not work (Kiyoshi wrote a private Mail to me).

 Or can't we just #include libintl.h on all platforms?

I wouldn't expect this to work everywhere.

Another idea: how often do we use ngettext ? AFAIR, only 1 or 2 times in the 
code. So why not remove the #define and amend those two occurrences ?

Tim


signature.asc
Description: This is a digitally signed message part.