aboutsummaryrefslogtreecommitdiff
path: root/intl/bindtextdom.c
diff options
context:
space:
mode:
Diffstat (limited to 'intl/bindtextdom.c')
-rw-r--r--intl/bindtextdom.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c
index 45000a6b58..1b22bfc648 100644
--- a/intl/bindtextdom.c
+++ b/intl/bindtextdom.c
@@ -1,5 +1,5 @@
/* Implementation of the bindtextdomain(3) function
- Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -42,9 +42,8 @@ void free ();
#ifdef _LIBC
# include <libintl.h>
#else
-# include "libgettext.h"
+# include "libgnuintl.h"
#endif
-#include "gettext.h"
#include "gettextP.h"
#ifdef _LIBC
@@ -65,6 +64,11 @@ void free ();
# define _nl_domain_bindings _nl_domain_bindings__
#endif
+/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
+#ifndef offsetof
+# define offsetof(type,ident) ((size_t)&(((type*)0)->ident))
+#endif
+
/* @@ end of prolog @@ */
/* Contains the default location of the message catalogs. */
@@ -93,8 +97,9 @@ __libc_rwlock_define (extern, _nl_state_lock)
#endif
/* Prototypes for local functions. */
-static void set_binding_values (const char *domainname, const char **dirnamep,
- const char **codesetp);
+static void set_binding_values PARAMS ((const char *domainname,
+ const char **dirnamep,
+ const char **codesetp));
/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
to be used for the DOMAINNAME message catalog.
@@ -234,7 +239,7 @@ set_binding_values (domainname, dirnamep, codesetp)
/* We have to create a new binding. */
size_t len = strlen (domainname) + 1;
struct binding *new_binding =
- (struct binding *) malloc (sizeof (*new_binding) + len);
+ (struct binding *) malloc (offsetof (struct binding, domainname) + len);
if (__builtin_expect (new_binding == NULL, 0))
goto failed;