]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Portability fixes.
authorBruno Haible <bruno@clisp.org>
Tue, 11 Dec 2001 19:48:56 +0000 (19:48 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jun 2009 21:42:07 +0000 (23:42 +0200)
lib/ChangeLog
lib/argmatch.c
lib/copy-file.c
lib/gcd.c
lib/setenv.c

index d8c0ec2be2e849c01cd9da716bf983383c85d29c..9071dc89bc16b617ee56dbdf7ceff7720fee2f6c 100644 (file)
@@ -1,3 +1,12 @@
+2001-12-11  Bruno Haible  <bruno@clisp.org>
+
+       * argmatch.c: Include <stdlib.h>, to declare exit().
+       * copy-file.c: Include <sys/stat.h>, for struct stat.
+       * gcd.c: Include <stdlib.h>, to declare abort().
+       * setenv.c: Declare alloca.
+       (compar_fn_t): New typedef.
+       (KNOWN_VALUE, STORE_VALUE): Use it.
+
 2001-12-08  Bruno Haible  <bruno@clisp.org>
 
        * pipe-in.c (create_pipe_in): Don't redirect stdin if prog_stdin
index 2ed60cbf8afb34d601eb5c4f3fcc7d696a011e69..da664efc927074b1ec9e2a94eb6b1a93f11b01d8 100644 (file)
@@ -21,6 +21,7 @@
 #include "argmatch.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 #ifdef STDC_HEADERS
 # include <string.h>
 #endif
index 130ef665fcf297093dc5b1c7ec435c94498f1cd4..10670771d20720409e7592b23eeeb5678ae05f26 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <sys/stat.h>
 
 #if HAVE_UTIME || HAVE_UTIMES
 # include <utime.h>
index a2dfc528998e1fbdeaa9de0e9cc218e1917f45b1..4d9e88f2d9c2d802f3d7dd471f11b4712f450a25 100644 (file)
--- a/lib/gcd.c
+++ b/lib/gcd.c
@@ -19,6 +19,8 @@
 /* Specification.  */
 #include "gcd.h"
 
+#include <stdlib.h>
+
 /* Return the greatest common divisor of a > 0 and b > 0.  */
 unsigned int
 gcd (a, b)
index a7c1e167bdd7c57e618fb295a8f79409ff177095..dae9f403e47af60614bf98dac2b054be116749ce 100644 (file)
 # include <config.h>
 #endif
 
+#ifdef __GNUC__
+# ifndef alloca
+#  define alloca __builtin_alloca
+# endif
+#else
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+ #pragma alloca
+#  else
+#   ifdef __hpux /* This section must match that of bison generated files. */
+#    ifdef __cplusplus
+extern "C" void *alloca (unsigned int);
+#    else /* not __cplusplus */
+void *alloca ();
+#    endif /* not __cplusplus */
+#   else /* not __hpux */
+#    ifndef alloca
+char *alloca ();
+#    endif
+#   endif /* __hpux */
+#  endif
+# endif
+#endif
+
 #include <errno.h>
 #if !_LIBC
 # if !defined errno && !defined HAVE_ERRNO_DECL
@@ -73,6 +99,7 @@ __libc_lock_define_initialized (static, envlock)
                      && defined __GNUC__)
 # define USE_TSEARCH   1
 # include <search.h>
+typedef int (*compar_fn_t) PARAMS ((const void *, const void *));
 
 /* This is a pointer to the root of the search tree with the known
    values.  */
@@ -80,11 +107,11 @@ static void *known_values;
 
 # define KNOWN_VALUE(Str) \
   ({                                                                         \
-    void *value = tfind (Str, &known_values, (__compar_fn_t) strcmp);        \
+    void *value = tfind (Str, &known_values, (compar_fn_t) strcmp);          \
     value != NULL ? *(char **) value : NULL;                                 \
   })
 # define STORE_VALUE(Str) \
-  tsearch (Str, &known_values, (__compar_fn_t) strcmp)
+  tsearch (Str, &known_values, (compar_fn_t) strcmp)
 
 #else
 # undef USE_TSEARCH