intl patches (10)
Bruno Haible
haible@ilog.fr
Mon Mar 19 11:28:00 GMT 2001
The gettext/intl should call its own functions, not those in libc. (Otherwise
we get into versioning problems.) Here is a patch to use __ suffix outside
libc but __ prefix inside libc.
Furthermore it removes the declaration of __gettextdebug, which exists but
is unused, and converts the prototypes for these functions to be K&R C
compatible.
This patch doesn't cause behaviour changes in glibc.
2001-01-07 Bruno Haible <haible@clisp.cons.org>
* intl/gettextP.h (__gettextdebug): Remove declaration.
(__gettext_free_exp, __gettextparse): Convert prototype to K&R C
syntax.
(gettext_free_exp__, gettextparse__): New non-libc declarations.
* intl/plural.y [!_LIBC]: Define gettextparse__, gettext_free_exp__,
not __gettextparse, __gettext_free_exp.
* intl/loadmsgcat.c [!_LIBC]: Use gettextparse__, not __gettextparse.
diff -r -c3 intl/gettextP.h intl/gettextP.h
*** intl/gettextP.h Sat Mar 17 17:42:23 2001
--- intl/gettextP.h Sat Mar 17 18:53:53 2001
***************
*** 225,233 ****
const char *__codeset));
#endif
! extern int __gettextdebug;
! extern void __gettext_free_exp (struct expression *exp) internal_function;
! extern int __gettextparse (void *arg);
/* @@ begin of epilog @@ */
--- 225,239 ----
const char *__codeset));
#endif
! #ifdef _LIBC
! extern void __gettext_free_exp PARAMS ((struct expression *exp))
! internal_function;
! extern int __gettextparse PARAMS ((void *arg));
! #else
! extern void gettext_free_exp__ PARAMS ((struct expression *exp))
! internal_function;
! extern int gettextparse__ PARAMS ((void *arg));
! #endif
/* @@ begin of epilog @@ */
diff -r -c3 intl/loadmsgcat.c intl/loadmsgcat.c
*** intl/loadmsgcat.c Sat Mar 17 18:35:52 2001
--- intl/loadmsgcat.c Sat Mar 17 18:53:53 2001
***************
*** 81,86 ****
--- 81,96 ----
# define munmap __munmap
#endif
+ /* Names for the libintl functions are a problem. They must not clash
+ with existing names and they should follow ANSI C. But this source
+ code is also used in GNU C Library where the names have a __
+ prefix. So we have to make a difference here. */
+ #ifdef _LIBC
+ # define PLURAL_PARSE __gettextparse
+ #else
+ # define PLURAL_PARSE gettextparse__
+ #endif
+
/* We need a sign, whether a new catalog was loaded, which can be associated
with all translations. This is important if the translations are
cached by one of GCC's features. */
***************
*** 403,409 ****
is passed down to the parser. */
plural += 7;
args.cp = plural;
! if (__gettextparse (&args) != 0)
goto no_plural;
domain->plural = args.res;
}
--- 413,419 ----
is passed down to the parser. */
plural += 7;
args.cp = plural;
! if (PLURAL_PARSE (&args) != 0)
goto no_plural;
domain->plural = args.res;
}
diff -r -c3 intl/plural.y intl/plural.y
*** intl/plural.y Sat Mar 17 18:24:05 2001
--- intl/plural.y Sat Mar 17 18:54:33 2001
***************
*** 26,31 ****
--- 26,42 ----
#include <stdlib.h>
#include "gettextP.h"
+ /* Names for the libintl functions are a problem. They must not clash
+ with existing names and they should follow ANSI C. But this source
+ code is also used in GNU C Library where the names have a __
+ prefix. So we have to make a difference here. */
+ #ifdef _LIBC
+ # define FREE_EXPRESSION __gettext_free_exp
+ #else
+ # define FREE_EXPRESSION gettext_free_exp__
+ # define __gettextparse gettextparse__
+ #endif
+
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
#define YYPARSE_PARAM arg
%}
***************
*** 140,146 ****
if (newp == NULL)
while (n-- > 0)
! __gettext_free_exp (va_arg (va, struct expression *));
else
{
newp->operation = op;
--- 151,157 ----
if (newp == NULL)
while (n-- > 0)
! FREE_EXPRESSION (va_arg (va, struct expression *));
else
{
newp->operation = op;
***************
*** 156,162 ****
|| newp->val.args3.tbranch == NULL
|| (n > 2 && newp->val.args3.fbranch == NULL))
{
! __gettext_free_exp (newp);
newp = NULL;
}
}
--- 167,173 ----
|| newp->val.args3.tbranch == NULL
|| (n > 2 && newp->val.args3.fbranch == NULL))
{
! FREE_EXPRESSION (newp);
newp = NULL;
}
}
***************
*** 169,175 ****
void
internal_function
! __gettext_free_exp (exp)
struct expression *exp;
{
if (exp == NULL)
--- 180,186 ----
void
internal_function
! FREE_EXPRESSION (exp)
struct expression *exp;
{
if (exp == NULL)
***************
*** 179,185 ****
switch (exp->operation)
{
case qmop:
! __gettext_free_exp (exp->val.args3.fbranch);
/* FALLTHROUGH */
case mult:
--- 190,196 ----
switch (exp->operation)
{
case qmop:
! FREE_EXPRESSION (exp->val.args3.fbranch);
/* FALLTHROUGH */
case mult:
***************
*** 191,198 ****
case not_equal:
case land:
case lor:
! __gettext_free_exp (exp->val.args2.right);
! __gettext_free_exp (exp->val.args2.left);
break;
default:
--- 202,209 ----
case not_equal:
case land:
case lor:
! FREE_EXPRESSION (exp->val.args2.right);
! FREE_EXPRESSION (exp->val.args2.left);
break;
default:
More information about the Libc-alpha
mailing list