]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Minor tweaks.
authorBruno Haible <bruno@clisp.org>
Wed, 10 Jan 2001 18:26:44 +0000 (18:26 +0000)
committerBruno Haible <bruno@clisp.org>
Wed, 10 Jan 2001 18:26:44 +0000 (18:26 +0000)
intl/ChangeLog
intl/bindtextdom.c
intl/dcigettext.c
intl/gettextP.h
src/ChangeLog
src/msgunfmt.c

index 2139ef64c5b667234c15fff990efab9d14860375..2521469dc445b4599945afd4df07d75763bf262b 100644 (file)
@@ -1,3 +1,17 @@
+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
index 14e633b0e7fdc99c8d9b128140696d681f5b64f1..673a06177a32e4a16743d4529bd148646e218c40 100644 (file)
 # 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
@@ -233,7 +236,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;
index 1ecc857f1d966e48dbe2aa1ff99abddf96de8ec6..5dcb90a4c95911ed31ac47668a007a1d1b35b185 100644 (file)
@@ -53,8 +53,10 @@ extern int errno;
 # 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 ();
@@ -196,14 +198,6 @@ static void *mempcpy PARAMS ((void *dest, const void *src, size_t n));
 # 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
@@ -329,7 +323,7 @@ struct block_list
 typedef struct transmem_list
 {
   struct transmem_list *next;
-  char data[0];
+  char data[ZERO];
 } transmem_block_t;
 static struct transmem_list *transmem_list;
 #else
@@ -623,8 +617,8 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
                  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);
index 11d256ce5f2b99b2d80b00aeb3892fb6bba88729..8a3320c94f68e445e72114357bf8ea7d8bdf3da4 100644 (file)
@@ -138,16 +138,20 @@ struct loaded_domain
   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;
index 481f2d994555da182e8446f6806ee4480023d257..28faa9f03ebd9000abe16f38bfd62f35c4ca65ac 100644 (file)
@@ -1,3 +1,7 @@
+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.
index 6c5b6b7090fa8ec32c212ce2ead8f60ef9783908..758cbedf44c99351abac0ae4584f3ae4bfd81631 100644 (file)
@@ -1,5 +1,5 @@
 /* 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
@@ -329,14 +329,14 @@ string32 (fp, fn, offset)
        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;
@@ -346,7 +346,7 @@ read_mo_file (mlp, fn)
   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
     {