From: Bruno Haible Date: Tue, 11 Dec 2001 19:48:56 +0000 (+0000) Subject: Portability fixes. X-Git-Tag: v0.11~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44d0a5fef59939bd2a7e1117c24509ecd1554871;p=thirdparty%2Fgettext.git Portability fixes. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index d8c0ec2be..9071dc89b 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,12 @@ +2001-12-11 Bruno Haible + + * argmatch.c: Include , to declare exit(). + * copy-file.c: Include , for struct stat. + * gcd.c: Include , to declare abort(). + * setenv.c: Declare alloca. + (compar_fn_t): New typedef. + (KNOWN_VALUE, STORE_VALUE): Use it. + 2001-12-08 Bruno Haible * pipe-in.c (create_pipe_in): Don't redirect stdin if prog_stdin diff --git a/lib/argmatch.c b/lib/argmatch.c index 2ed60cbf8..da664efc9 100644 --- a/lib/argmatch.c +++ b/lib/argmatch.c @@ -21,6 +21,7 @@ #include "argmatch.h" #include +#include #ifdef STDC_HEADERS # include #endif diff --git a/lib/copy-file.c b/lib/copy-file.c index 130ef665f..10670771d 100644 --- a/lib/copy-file.c +++ b/lib/copy-file.c @@ -26,6 +26,7 @@ #include #include +#include #if HAVE_UTIME || HAVE_UTIMES # include diff --git a/lib/gcd.c b/lib/gcd.c index a2dfc5289..4d9e88f2d 100644 --- a/lib/gcd.c +++ b/lib/gcd.c @@ -19,6 +19,8 @@ /* Specification. */ #include "gcd.h" +#include + /* Return the greatest common divisor of a > 0 and b > 0. */ unsigned int gcd (a, b) diff --git a/lib/setenv.c b/lib/setenv.c index a7c1e167b..dae9f403e 100644 --- a/lib/setenv.c +++ b/lib/setenv.c @@ -20,6 +20,32 @@ # include #endif +#ifdef __GNUC__ +# ifndef alloca +# define alloca __builtin_alloca +# endif +#else +# if HAVE_ALLOCA_H +# include +# 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 #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 +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