]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
New include files xmalloc.h and strstr.h.
authorBruno Haible <bruno@clisp.org>
Thu, 27 Sep 2001 14:00:33 +0000 (14:00 +0000)
committerBruno Haible <bruno@clisp.org>
Thu, 27 Sep 2001 14:00:33 +0000 (14:00 +0000)
47 files changed:
lib/ChangeLog
lib/Makefile.am
lib/concatpath.c
lib/findprog.c
lib/fstrcmp.c
lib/hash.c
lib/javacomp.c
lib/javaexec.c
lib/sh-quote.c
lib/strstr.h [new file with mode: 0644]
lib/system.h
lib/xgetcwd.c
lib/xmalloc.c
lib/xmalloc.h [new file with mode: 0644]
lib/xstrdup.c
src/ChangeLog
src/file-list.c
src/format-c.c
src/format-java.c
src/format-lisp.c
src/format-python.c
src/format-ycp.c
src/gettext.c
src/message.c
src/msgcmp.c
src/msgen.c
src/msgexec.c
src/msgfmt.c
src/msggrep.c
src/msgl-cat.c
src/msgl-charset.c
src/msgl-iconv.c
src/ngettext.c
src/po-charset.c
src/po-gram-gen.y
src/po-hash-gen.y
src/po-lex.c
src/po.c
src/read-mo.c
src/read-po.c
src/str-list.c
src/write-java.c
src/write-po.c
src/x-c.c
src/x-java.l
src/x-po.c
src/xgettext.c

index dcb1d614adce600ae253fa989c64246d5963c6f6..04a1cd749d03feed1294bd9ea5f798b36e4b03c5 100644 (file)
@@ -1,3 +1,28 @@
+2001-09-09  Bruno Haible  <haible@clisp.cons.org>
+
+       * xmalloc.h: New file.
+       * strstr.h: New file.
+       * system.h (xmalloc, xrealloc, xstrdup): Remove declarations, now in
+       xmalloc.h.
+       (parse_printf_format, asprintf): Remove declarations.
+       (strstr): Remove declaration, now in strstr.h.
+       * xmalloc.c: Include xmalloc.h. Modernize. Assume <stdlib.h> exists.
+       * xstrdup.c: Include xmalloc.h. Modernize. Assume <string.h> exists.
+       * concatpath.c: Include xmalloc.h.
+       * findprog.c: Likewise.
+       * fstrcmp.c: Include xmalloc.h instead of system.h.
+       * javacomp.c: Likewise.
+       * javaexec.c: Likewise.
+       * sh-quote.c: Likewise.
+       * hash.c: Include xmalloc.h. Don't declare xmalloc, xcalloc.
+       * xgetcwd.c: Include stdlib.h and xmalloc.h. Don't declare xmalloc,
+       xstrdup, free.
+       * Makefile.am (libnlsut_a_HEADER): Add xmalloc.h.
+       (LIBADD_HEADER): Add strstr.h.
+
+       * Makefile.am (INCLUDES): Add -I$(top_srcdir)/intl. Needed because
+       some files include "libgettext.h", in the case $builddir != $srcdir.
+
 2001-09-25  Bruno Haible  <haible@clisp.cons.org>
 
        * javacomp.c (compile_java_class): Recognize javac exit code 2.
index 235a87ea7c70da87b9a53978bbed0fd1f4cfb7b7..3adfb832e1422b1a8407b741d50fe16195c2469c 100644 (file)
@@ -32,7 +32,7 @@ xmalloc.c xstrdup.c
 libnlsut_a_HEADER = c-ctype.h execute.h findprog.h fstrcmp.h full-write.h \
 gcd.h getopt.h hash.h javacomp.h javaexec.h lbrkprop.h linebreak.h mbswidth.h \
 obstack.h pathmax.h pipe.h progname.h sh-quote.h system.h tmpdir.h \
-utf8-ucs4.h utf16-ucs4.h wait-process.h xerror.h
+utf8-ucs4.h utf16-ucs4.h wait-process.h xerror.h xmalloc.h
 
 # Sources that are compiled only on platforms that lack the functions.
 
@@ -40,7 +40,7 @@ LIBADD_SOURCE = alloca.c error.c getline.c memset.c mkdtemp.c setenv.c \
 stpcpy.c stpncpy.c strcasecmp.c strcspn.c strncasecmp.c strpbrk.c strstr.c \
 strtol.c strtoul.c vasprintf.c
 
-LIBADD_HEADER = error.h getline.h mkdtemp.h setenv.h strpbrk.h
+LIBADD_HEADER = error.h getline.h mkdtemp.h setenv.h strpbrk.h strstr.h
 
 # Unused sources.
 
@@ -60,7 +60,7 @@ stdbool.h.in \
 gen-lbrkprop.c 3level.h
 
 DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@
-INCLUDES = -I. -I$(srcdir) -I.. -I../intl
+INCLUDES = -I. -I$(srcdir) -I.. -I../intl -I$(top_srcdir)/intl
 
 
 all-local: @STDBOOL_H@
index cc9088d8592acccc47a6bfd4217d611545d93ac3..1d494f9926d07104081f79ada895543cf98635c7 100644 (file)
@@ -25,6 +25,8 @@
 /* Specification.  */
 #include "system.h"
 
+#include "xmalloc.h"
+
 /* Concatenate a directory pathname, a relative pathname and an optional
    suffix.  The directory may end with the directory separator.  The second
    argument may not start with the directory separator (it is relative).
index 5b18d562b4e86385542dd639bfbcdda0bd3891c8..601376824eaa7d369f20bf6b4d560faea37441a1 100644 (file)
@@ -31,6 +31,7 @@
 # include <unistd.h>
 #endif
 
+#include "xmalloc.h"
 #include "system.h"
 
 
index 7604aa5ce0f738bced5521d31b14d7ba63753773..ef73d1f18aef514ab8fcf01f2b7dc7bbfcd96710 100644 (file)
@@ -41,7 +41,7 @@
 #include <stdio.h>
 #include <limits.h>
 
-#include "system.h"
+#include "xmalloc.h"
 
 
 /*
@@ -622,7 +622,7 @@ fstrcmp (string1, string2)
        ((number of chars in common) / (average length of the strings)).
      This is admittedly biased towards finding that the strings are
      similar, however it does produce meaningful results.  */
-  return ((double) (string[0].data_length + string[1].data_length -
-    string[1].edit_count - string[0].edit_count) / (string[0].data_length
-    + string[1].data_length));
+  return ((double) (string[0].data_length + string[1].data_length
+                   - string[1].edit_count - string[0].edit_count)
+         / (string[0].data_length + string[1].data_length));
 }
index f7f9ff334c1fd4f49559687bc4bdc1c2f40a609a..c76e587e76a2a9a550d14ffeed9458b9f6975817 100644 (file)
@@ -50,6 +50,8 @@
 # include <values.h>
 #endif
 
+#include "xmalloc.h"
+
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
 
@@ -65,9 +67,6 @@
 # define bcopy(S, D, N)        memcpy ((D), (S), (N))
 #endif
 
-extern void *xmalloc PARAMS ((size_t __n));
-extern void *xcalloc PARAMS ((size_t __n, size_t __m));
-
 typedef struct hash_entry
 {
   unsigned long used;
index 1c0449810465bfeda77358eb6d8515e214d10882..04598a809cae8221dd1705611e61b6b2c5b9d0fb 100644 (file)
@@ -30,7 +30,7 @@
 #include "execute.h"
 #include "setenv.h"
 #include "sh-quote.h"
-#include "system.h"
+#include "xmalloc.h"
 #include "error.h"
 #include "libgettext.h"
 
index 3053b37e3cfac200f51fec86824516c2ed64f2ee..162685556db3d2c26dcd348d06daff5ccff48f53 100644 (file)
@@ -30,7 +30,7 @@
 #include "execute.h"
 #include "setenv.h"
 #include "sh-quote.h"
-#include "system.h"
+#include "xmalloc.h"
 #include "error.h"
 #include "libgettext.h"
 
index 4ecbc528e4e062fd04e23e17daae3ca59bd42636..8cc300f92d0e2774f90851070e6c29921625b1bd 100644 (file)
@@ -26,7 +26,7 @@
 #include <string.h>
 
 #include "strpbrk.h"
-#include "system.h"
+#include "xmalloc.h"
 
 
 #define SHELL_SPECIAL_CHARS "\t\n !\"#$&'()*;<=>?[\\]`{|}~"
diff --git a/lib/strstr.h b/lib/strstr.h
new file mode 100644 (file)
index 0000000..5b89757
--- /dev/null
@@ -0,0 +1,36 @@
+/* Searching in a string.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef PARAMS
+# if defined (__GNUC__) || __STDC__
+#  define PARAMS(Args) Args
+# else
+#  define PARAMS(Args) ()
+# endif
+#endif
+
+#if HAVE_STRSTR
+
+/* Get strstr() declaration.  */
+#include <string.h>
+
+#else
+
+/* Find the first occurrence of NEEDLE in HAYSTACK.  */
+extern char *strstr PARAMS ((const char *haystack, const char *needle));
+
+#endif
index 54af31d626dfcab62b8e310d14af6c4641a3ca1b..20bae4a10254ea7e21c72becf6b223931d17c1e9 100644 (file)
@@ -40,18 +40,11 @@ unsigned long strtoul ();
 
 /* Wrapper functions with error checking for standard functions.  */
 extern char *xgetcwd PARAMS ((void));
-extern void *xmalloc PARAMS ((size_t __n));
-extern void *xrealloc PARAMS ((void *__p, size_t __n));
-extern char *xstrdup PARAMS ((const char *__string));
 extern char *stpcpy PARAMS ((char *__dst, const char *__src));
 extern char *stpncpy PARAMS ((char *__dst, const char *__src, size_t __n));
-extern size_t parse_printf_format PARAMS ((const char *__fmt, size_t __n,
-                                          int *__argtypes));
-extern int asprintf PARAMS ((char **, const char *, ...));
 extern int strcasecmp PARAMS ((const char *__s1, const char *__s2));
 extern int strncasecmp PARAMS ((const char *__s1, const char *__s2,
                                size_t __n));
-extern char *strstr PARAMS ((const char *__str, const char *__sub));
 
 #include <string.h>
 #if !STDC_HEADERS && HAVE_MEMORY_H
index 896be5d6aabb7e1ccd30e00bad4296d11f102815..401f0802a685155554a89873468e3190a096a60b 100644 (file)
@@ -21,6 +21,7 @@
 # include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
 #ifndef errno
@@ -37,9 +38,7 @@ char *getwd ();
 # define getcwd(Buf, Max) getwd (Buf)
 #endif
 
-extern void *xmalloc ();
-extern char *xstrdup ();
-extern void free ();
+#include "xmalloc.h"
 
 /* Return the current directory, newly allocated, arbitrarily long.
    Return NULL and set errno on error. */
index 8e5df0f09e96ef6a9d31cce794a8438ec186c434..f0e1eea17a3a5efe3568a1fb93a1fcf0055f2d1c 100644 (file)
 # include <config.h>
 #endif
 
-#if __STDC__
-# define VOID void
-#else
-# define VOID char
-#endif
-
-#include <sys/types.h>
+/* Specification.  */
+#include "xmalloc.h"
 
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#else
-VOID *calloc ();
-VOID *malloc ();
-VOID *realloc ();
-void free ();
-#endif
-
-#if ENABLE_NLS
-# include <libintl.h>
-# define _(Text) gettext (Text)
-#else
-# define textdomain(Domain)
-# define _(Text) Text
-#endif
+#include <stdlib.h>
 
 #include "error.h"
+#include "libgettext.h"
 
 #ifndef EXIT_FAILURE
 # define EXIT_FAILURE 1
 #endif
 
-#ifndef NULL
-# define NULL ((VOID *) 0)
-#endif
+#define _(str) gettext (str)
 
-/* Prototypes for functions defined here.  */
-#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
-static VOID *fixup_null_alloc (size_t n);
-VOID *xmalloc (size_t n);
-VOID *xcalloc (size_t n, size_t s);
-VOID *xrealloc (VOID *p, size_t n);
-#endif
+
+/* Prototypes for local functions.  Needed to ensure compiler checking of
+   function argument counts despite of K&R C function definition syntax.  */
+static void *fixup_null_alloc PARAMS ((size_t n));
 
 
 /* Exit value when the requested amount of memory is not available.
    The caller may set it to some other value.  */
 int xmalloc_exit_failure = EXIT_FAILURE;
 
-#if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT)
-extern void error (int, int, const char *, ...);
-#else
-extern void error ();
-#endif
-
-static VOID *
+static void *
 fixup_null_alloc (n)
      size_t n;
 {
-  VOID *p;
+  void *p;
 
   p = 0;
   if (n == 0)
@@ -89,11 +59,11 @@ fixup_null_alloc (n)
 
 /* Allocate N bytes of memory dynamically, with error checking.  */
 
-VOID *
+void *
 xmalloc (n)
      size_t n;
 {
-  VOID *p;
+  void *p;
 
   p = malloc (n);
   if (p == NULL)
@@ -103,11 +73,11 @@ xmalloc (n)
 
 /* Allocate memory for N elements of S bytes, with error checking.  */
 
-VOID *
+void *
 xcalloc (n, s)
      size_t n, s;
 {
-  VOID *p;
+  void *p;
 
   p = calloc (n, s);
   if (p == NULL)
@@ -119,9 +89,9 @@ xcalloc (n, s)
    with error checking.
    If P is NULL, run xmalloc.  */
 
-VOID *
+void *
 xrealloc (p, n)
-     VOID *p;
+     void *p;
      size_t n;
 {
   if (p == NULL)
diff --git a/lib/xmalloc.h b/lib/xmalloc.h
new file mode 100644 (file)
index 0000000..880bb40
--- /dev/null
@@ -0,0 +1,44 @@
+/* malloc with out of memory checking.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   Written by Bruno Haible <haible@clisp.cons.org>, 2001.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef _XMALLOC_H
+#define _XMALLOC_H
+
+#include <stddef.h>
+
+
+/* Defined in xmalloc.c.  */
+
+/* Allocate SIZE bytes of memory dynamically, with error checking.  */
+extern void *xmalloc PARAMS ((size_t size));
+
+/* Allocate memory for NMEMB elements of SIZE bytes, with error checking.  */
+extern void *xcalloc PARAMS ((size_t nmemb, size_t size));
+
+/* Change the size of an allocated block of memory PTR to SIZE bytes,
+   with error checking.  If PTR is NULL, run xmalloc.  */
+extern void *xrealloc PARAMS ((void *ptr, size_t size));
+
+
+/* Defined in xstrdup.c.  */
+
+/* Return a newly allocated copy of STRING.  */
+extern char *xstrdup PARAMS ((const char *string));
+
+
+#endif /* _XMALLOC_H */
index d71f7ae4e8a76785a90eb0657b93f7ac13947b98..ca117a7c6febcdcc00a8f3c1ad965341edeb60d9 100644 (file)
@@ -1,5 +1,5 @@
 /* xstrdup.c -- copy a string with out of memory checking
-   Copyright (C) 1990, 1996, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1996, 2000, 2001 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 # include <config.h>
 #endif
 
-#if HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+/* Specification.  */
+#include "xmalloc.h"
 
-#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
-extern char *xmalloc (size_t);
-#else
-extern char *xmalloc ();
-#endif
+#include <string.h>
 
 /* Return a newly allocated copy of STRING.  */
 
index 39bd81f204b73ef893d5149864b731e6a6616097..8b5aee2b73b2894ebe23b1631041f735f97ef8a0 100644 (file)
@@ -1,3 +1,37 @@
+2001-09-09  Bruno Haible  <haible@clisp.cons.org>
+
+       * file-list.c: Include system.h.
+       * format-c.c: Include xmalloc.h instead of system.h.
+       * format-ycp.c: Likewise.
+       * read-po.c: Likewise.
+       * x-po.c: Likewise.
+       * format-java.c: Include xmalloc.h.
+       * format-lisp.c: Likewise.
+       * format-python.c: Likewise.
+       * gettext.c: Likewise.
+       * msgen.c: Likewise.
+       * msgexec.c: Likewise.
+       * msggrep.c: Likewise.
+       * ngettext.c: Likewise.
+       * po-lex.c: Likewise.
+       * read-mo.c: Likewise.
+       * x-c.c: Likewise.
+       * message.c: Include xmalloc.h and strstr.h.
+       * msgfmt.c: Likewise.
+       * write-po.c: Likewise.
+       * msgl-cat.c: Include string.h, xmalloc.h and strstr.h.
+       * msgl-iconv.c: Likewise.
+       * msgl-charset.c: Include strstr.h.
+       * po-charset.c: Likewise.
+       * po-gram-gen.y: Include stdlib.h, xmalloc.h instead of system.h.
+       * po-hash-gen.y: Likewise.
+       * str-list.c: Likewise.
+       * po.c: Include string.h, xmalloc.h instead of system.h.
+       * write-java.c: Include string.h, xmalloc.h.
+       * x-java.l: Include stdlib.h, xmalloc.h, strstr.h instead of system.h.
+       * xgettext.c: Include xmalloc.h, strstr.h, xerror.h.
+       (main, construct_header): Use xasprintf instead of asprintf.
+
 2001-09-24  Bruno Haible  <haible@clisp.cons.org>
 
        * po-lex.c (mb_iseq): Compare the byte sequence, not the Unicode
index e2da4612fe02d5edd889cae1090259dc0cfd1797..cfe8edd1c690f717bfe83ec7f576cfdfb89e14f6 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "str-list.h"
 #include "error.h"
+#include "system.h"
 #include "getline.h"
 #include "libgettext.h"
 
index e8ec0a16fca3dd613bb7b4388b1918613dd9027a..dd67c3b34bde5e54ed68d36c4587c56ad21791b5 100644 (file)
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 
 #include "format.h"
-#include "system.h"
+#include "xmalloc.h"
 #include "error.h"
 #include "progname.h"
 #include "libgettext.h"
index fbc5549e549f99ec7fef57fb94b3cef2a68e8b92..1000d2597dcb0a2df6cf823d5f85a78791dc41eb 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "format.h"
 #include "c-ctype.h"
+#include "xmalloc.h"
 #include "system.h"
 #include "error.h"
 #include "progname.h"
index b8fc0906975a71efdefe8bb4d7ea059b02d1e7ae..267fb5e5d96a0e65d1b5a2376f2faa94a13a4eaa 100644 (file)
@@ -26,6 +26,7 @@
 #include "format.h"
 #include "c-ctype.h"
 #include "gcd.h"
+#include "xmalloc.h"
 #include "system.h"
 #include "error.h"
 #include "progname.h"
index 6840f039458669f6d986caf27a266d372d49be71..a19a751b0fc19be63bd8f258da6bc6a1c40db6dc 100644 (file)
@@ -25,6 +25,7 @@
 #include <string.h>
 
 #include "format.h"
+#include "xmalloc.h"
 #include "system.h"
 #include "error.h"
 #include "progname.h"
index 61bd74a2401c50183c66fbc4a165980806c9c58f..80066ffa3cea498feadc3ad0154f9afc814453a3 100644 (file)
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 
 #include "format.h"
-#include "system.h"
+#include "xmalloc.h"
 #include "error.h"
 #include "progname.h"
 #include "libgettext.h"
index fd2817569eb6e233b0b0567bf8c78b129b9b1cb2..f89725ce2339bc808b78b85bb60c57451370361f 100644 (file)
@@ -27,6 +27,7 @@
 #include <locale.h>
 
 #include "error.h"
+#include "xmalloc.h"
 #include "system.h"
 
 #ifdef TESTS
index cac5c6dd5c94e28781c3e54714b656d8cb5c1349..1a3cf466c41ac3cc7040bf31c517cce362127874 100644 (file)
@@ -28,6 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <string.h>
 
 #include "fstrcmp.h"
+#include "xmalloc.h"
+#include "strstr.h"
 #include "system.h"
 
 
index 039dcc4ca87c1c4d0e5373f8d67497b8241fb1e1..390786b7bed465ddd77473a649ebe79e622de258 100644 (file)
@@ -30,7 +30,7 @@
 #include "error.h"
 #include "progname.h"
 #include "message.h"
-#include <system.h>
+#include "system.h"
 #include "libgettext.h"
 #include "po.h"
 #include "str-list.h"
index e4526b959221ee29545f1070ca690e4f70756f46..1dc7f0a94f6620778be9979dff68996a401a8090 100644 (file)
@@ -32,6 +32,7 @@
 #include "message.h"
 #include "read-po.h"
 #include "write-po.h"
+#include "xmalloc.h"
 #include "system.h"
 #include "libgettext.h"
 
index 83898449bbcbf0312e59a565dab19479563db8d1..86f476fceb4af5d32c63bbbb6c3890ad4f1bec2f 100644 (file)
@@ -44,6 +44,7 @@
 #include "write-po.h"
 #include "str-list.h"
 #include "msgl-charset.h"
+#include "xmalloc.h"
 #include "system.h"
 #include "findprog.h"
 #include "pipe.h"
index aa2da2b70a0a5f1500e6959dd46544674eab36a0..3e2da47b0b235bbce12a9d7d4540f212199c245c 100644 (file)
@@ -34,6 +34,8 @@
 #include "xerror.h"
 #include "getline.h"
 #include "format.h"
+#include "xmalloc.h"
+#include "strstr.h"
 #include "system.h"
 #include "msgfmt.h"
 #include "write-mo.h"
index de1ab4f56bbddb180feaa8b5ad2c922188cb6272..85688ea3a642cc046c5f0ad30b43db200c2e860f 100644 (file)
@@ -42,6 +42,7 @@
 #include "write-po.h"
 #include "str-list.h"
 #include "msgl-charset.h"
+#include "xmalloc.h"
 #include "system.h"
 #include "full-write.h"
 #include "findprog.h"
index 8a5f0dd1154337d32ed3f70894fd25acf05840e9..a8809a5b1a396a8822c59e67a1f79318b4c77340 100644 (file)
@@ -25,6 +25,7 @@
 #include "msgl-cat.h"
 
 #include <stdlib.h>
+#include <string.h>
 
 #include "error.h"
 #include "xerror.h"
@@ -33,6 +34,8 @@
 #include "po-charset.h"
 #include "msgl-ascii.h"
 #include "msgl-iconv.h"
+#include "xmalloc.h"
+#include "strstr.h"
 #include "system.h"
 #include "libgettext.h"
 
index 45f01b9f2789a0add4352213c856359b976e5f7a..b803bbbbb15b9ace9d0d3beee63af6c474772e7c 100644 (file)
@@ -32,6 +32,7 @@
 #include "progname.h"
 #include "xerror.h"
 #include "message.h"
+#include "strstr.h"
 #include "system.h"
 #include "libgettext.h"
 
index e34c32887b26a8ccf11baa54521e42f5dbb0d4bf..b5fe4087f4a2d837a021ff1bf9fea3c919d567e1 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <errno.h>
 #include <stdlib.h>
+#include <string.h>
 
 #if HAVE_ICONV
 # include <iconv.h>
@@ -36,6 +37,8 @@
 #include "message.h"
 #include "po-charset.h"
 #include "msgl-ascii.h"
+#include "xmalloc.h"
+#include "strstr.h"
 #include "system.h"
 #include "libgettext.h"
 
index cf932de87605d37b2bda1dba1e93c9c2484c1e02..9f3bc4ba2fadeb080e3c6fd96472bd1fd6e15ef1 100644 (file)
@@ -27,6 +27,7 @@
 #include <errno.h>
 
 #include "error.h"
+#include "xmalloc.h"
 #include "system.h"
 
 #include "libgettext.h"
index f4fd12fc6a48236d426bf1ddff700750bdf7d541..d01da19345c10e159db2491609acb9650c702bc4 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "error.h"
 #include "xerror.h"
+#include "strstr.h"
 #include "system.h"
 #include "libgettext.h"
 
index da39d492ccb445be200f8061674905136e04f714..256291a381e0916195053353e700e69811eb00b2 100644 (file)
@@ -26,11 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "po-gram.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "str-list.h"
 #include "po-lex.h"
 #include "error.h"
-#include "system.h"
+#include "xmalloc.h"
 #include "libgettext.h"
 #include "po.h"
 
index 7232ee7b9d063e58a788dd797b024e0d753d7274..90b770735e616ed9343645c60a3dff1b471303dc 100644 (file)
@@ -27,8 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "po-hash.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 
-#include "system.h"
+#include "xmalloc.h"
 #include "po.h"
 
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
index ba5f27237a0ef4de1c286537011289d3f39469a7..b664d0f375b52fc674bb59f420389adecbf43984 100644 (file)
@@ -57,6 +57,7 @@
 
 #include "str-list.h"
 #include "po-charset.h"
+#include "xmalloc.h"
 #include "system.h"
 #include "error.h"
 #include "open-po.h"
index 951d72f3526129c007e95b5ca62f22d76e7ea720..589d36eefc0c2526c42105d99b0baa36f97bfa7e 100644 (file)
--- a/src/po.c
+++ b/src/po.c
@@ -26,10 +26,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "po.h"
 
 #include <stdlib.h>
+#include <string.h>
 
 #include "po-charset.h"
 #include "po-hash.h"
-#include "system.h"
+#include "xmalloc.h"
 
 /* Prototypes for local functions.  Needed to ensure compiler checking of
    function argument counts despite of K&R C function definition syntax.  */
index b740479b958d85411f8b0eed61efc029c331eb8c..deb739b2a0952291e73a8eaa39486da5f3f895bf 100644 (file)
@@ -32,6 +32,7 @@
 #include "gettext.h"
 
 #include "error.h"
+#include "xmalloc.h"
 #include "system.h"
 #include "message.h"
 #include "libgettext.h"
index 2e08b0c063c80ec3ab07cac0d831e4aeb0b43422..ad540f6d3be203fd85ae071872cda762127f119e 100644 (file)
@@ -27,7 +27,7 @@
 #include <string.h>
 
 #include "po.h"
-#include "system.h"
+#include "xmalloc.h"
 #include "libgettext.h"
 
 #define _(str) gettext (str)
index 4609434f734ea5ad535d5e2595127d18086acaca..98a8adb80b41c6ad4552fcbdab861c489d7d7d9b 100644 (file)
@@ -25,8 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "str-list.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 
-#include "system.h"
+#include "xmalloc.h"
 
 
 /* Initialize an empty list of strings.  */
index 04d006ea8c360f47b213d4caa24b1d3ccbde8856..c65f2e638df5c2975ea1d9819bf9626d5e6efa50 100644 (file)
@@ -28,6 +28,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <signal.h>
 
 #include <sys/stat.h>
@@ -70,6 +71,7 @@
 #include "pathmax.h"
 #include "plural-exp.h"
 #include "po-charset.h"
+#include "xmalloc.h"
 #include "system.h"
 #include "tmpdir.h"
 #include "utf8-ucs4.h"
index c101827220fa2f0a61d6cadd775eea98c3897f70..0313b2851b7fb515b3744d2d1f02406bd5defdc8 100644 (file)
@@ -37,6 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "c-ctype.h"
 #include "linebreak.h"
 #include "msgl-ascii.h"
+#include "xmalloc.h"
+#include "strstr.h"
 #include "system.h"
 #include "error.h"
 #include "xerror.h"
index 282c27d9a6c59934fcda3d74b957965fa37470e1..5f50af1e9369de40b903e2234dff31ba117b4f1d 100644 (file)
--- a/src/x-c.c
+++ b/src/x-c.c
@@ -33,6 +33,7 @@
 #include "xgettext.h"
 #include "error.h"
 #include "progname.h"
+#include "xmalloc.h"
 #include "system.h"
 #include "hash.h"
 #include "libgettext.h"
index 4238e4e11a51670511e51b70d6ef3e6ecb1674d5..dd317e501791ad7c6951b9fe28ab9e27b833863d 100644 (file)
 #endif
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "message.h"
 #include "x-java.h"
 #include "xgettext.h"
-#include "system.h"
+#include "xmalloc.h"
+#include "strstr.h"
 
 typedef enum
 {
index 0e49ddec4d0d73fc9f5c3ae9ab45a547e3b2f2dc..3063ba3d8a009af92e044a424cf61f189d6f47a6 100644 (file)
@@ -29,7 +29,7 @@
 #include "message.h"
 #include "x-po.h"
 #include "xgettext.h"
-#include "system.h"
+#include "xmalloc.h"
 #include "po.h"
 #include "po-lex.h"
 #include "libgettext.h"
index 75a801cf77568405876fb556b0c386a2749f261f..1e1051a195f02f760582b694e3d429e15b366b7e 100644 (file)
@@ -43,6 +43,9 @@
 #include "progname.h"
 #include "xerror.h"
 #include "getline.h"
+#include "xmalloc.h"
+#include "strstr.h"
+#include "xerror.h"
 #include "system.h"
 #include "po.h"
 #include "message.h"
@@ -311,13 +314,7 @@ main (argc, argv)
          if (optarg[len - 1] == '/')
            output_dir = xstrdup (optarg);
          else
-           {
-             asprintf (&output_dir, "%s/", optarg);
-             if (output_dir == NULL)
-               /* We are about to construct the absolute path to the
-                  directory for the output files but asprintf failed.  */
-               error (EXIT_FAILURE, errno, _("while preparing output"));
-           }
+           output_dir = xasprintf ("%s/", optarg);
        }
        break;
       case 's':
@@ -1103,7 +1100,7 @@ construct_header ()
       tz_sign = '-';
     }
 
-  asprintf (&msgstr, "\
+  msgstr = xasprintf ("\
 Project-Id-Version: PACKAGE VERSION\n\
 POT-Creation-Date: %d-%02d-%02d %02d:%02d%c%02ld%02ld\n\
 PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n\
@@ -1119,9 +1116,6 @@ Content-Transfer-Encoding: 8bit\n",
            local_time.tm_min,
            tz_sign, tz_min / 60, tz_min % 60);
 
-  if (msgstr == NULL)
-    error (EXIT_FAILURE, errno, _("while preparing output"));
-
   mp = message_alloc ("", NULL, msgstr, strlen (msgstr) + 1, &pos);
 
   if (foreign_user)