+2000-12-31 Bruno Haible <haible@clisp.cons.org>
+
+ * gettextP.h (ZERO): New macro.
+ (struct binding): Always use ZERO.
+ * bindtextdom.c (set_binding_values): Use offsetof, not sizeof.
+ Include <stddef.h> whenever possible.
+ * dcigettext.c (ZERO): Remove macro.
+ (struct transmem_list): Use ZERO.
+ (DCIGETTEXT): Use offsetof, not sizeof.
+ Include <stddef.h> whenever possible.
+
+ * config.charset: Update from libiconv-1.5.1.
+ * localcharset.c: Likewise.
+
2000-12-30 Bruno Haible <haible@clisp.cons.org>
* locale.alias: New file, moved here from ../misc/locale.alias. Add
# include <config.h>
#endif
-#if defined STDC_HEADERS || defined _LIBC
+#if defined HAVE_STDDEF_H || defined _LIBC
+# include <stddef.h>
+#endif
+#if defined HAVE_STDLIB_H || defined _LIBC
# include <stdlib.h>
#else
# ifdef HAVE_MALLOC_H
/* 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;
# define __set_errno(val) errno = (val)
#endif
-#if defined STDC_HEADERS || defined _LIBC
+#if defined HAVE_STDDEF_H || defined _LIBC
# include <stddef.h>
+#endif
+#if defined HAVE_STDLIB_H || defined _LIBC
# include <stdlib.h>
#else
char *getenv ();
# define HAVE_LOCALE_NULL
#endif
-/* We want to allocate a string at the end of the struct. gcc makes
- this easy. */
-#ifdef __GNUC__
-# define ZERO 0
-#else
-# define ZERO 1
-#endif
-
/* This is the type used for the search tree where known translations
are stored. */
struct known_translation_t
typedef struct transmem_list
{
struct transmem_list *next;
- char data[0];
+ char data[ZERO];
} transmem_block_t;
static struct transmem_list *transmem_list;
#else
struct known_translation_t *newp;
newp = (struct known_translation_t *)
- malloc (sizeof (*newp) + msgid_len
- + domainname_len + 1 - ZERO);
+ malloc (offsetof (struct known_translation_t, msgid)
+ + msgid_len + domainname_len + 1);
if (newp != NULL)
{
newp->domain = mempcpy (newp->msgid, msgid1, msgid_len);
unsigned long int nplurals;
};
+/* We want to allocate a string at the end of the struct. But ISO C
+ doesn't allow zero sized arrays. */
+#ifdef __GNUC__
+# define ZERO 0
+#else
+# define ZERO 1
+#endif
+
struct binding
{
struct binding *next;
char *dirname;
char *codeset;
-#ifdef __GNUC__
- char domainname[0];
-#else
- char domainname[1];
-#endif
+ char domainname[ZERO];
};
extern int _nl_msg_cat_cntr;
+2000-12-31 Bruno Haible <haible@clisp.cons.org>
+
+ * msgunfmt.c (read_mo_file): Recognize "/dev/stdin", not "/dev/stdout".
+
2000-12-31 Bruno Haible <haible@clisp.cons.org>
* str-list.h: Fix typo. Add comments.
/* msgunfmt - converts binary .mo files to Uniforum style .po files
- Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, April 1995.
This program is free software; you can redistribute it and/or modify
error (EXIT_FAILURE, errno, _("error while reading \"%s\""), fn);
error (EXIT_FAILURE, 0, _("file \"%s\" truncated"), fn);
}
- buffer[length] = 0;
+ buffer[length] = '\0';
/* Return the string to the caller. */
return buffer;
}
-/* This function reads and existing .mo file. Return a message list. */
+/* This function reads an existing .mo file. Return a message list. */
static message_list_ty *
read_mo_file (mlp, fn)
message_list_ty *mlp;
struct mo_file_header header;
int j;
- if (strcmp (fn, "-") == 0 || strcmp (fn, "/dev/stdout") == 0)
+ if (strcmp (fn, "-") == 0 || strcmp (fn, "/dev/stdin") == 0)
fp = stdin;
else
{