diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-05-19 14:22:18 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-05-19 14:22:18 -0400 |
commit | 7329af6b9ebf9c6167366870cb9304410b4617fd (patch) | |
tree | dd67adc18f110ff5cba5d91b284cfc07812ee89f /src/include/c.h | |
parent | 95fef6e82a7df4e4493f706c9be7a7455d70cc5d (diff) |
Support platforms where strtoll/strtoull are spelled __strtoll/__strtoull.
Ancient HPUX, for one, does this. We hadn't noticed due to the lack
of regression tests that required a working strtoll.
(I was slightly tempted to remove the other historical spelling,
strto[u]q, since it seems we have no buildfarm members testing that case.
But I refrained.)
Discussion: https://postgr.es/m/151935568942.1461.14623890240535309745@wrigleys.postgresql.org
Diffstat (limited to 'src/include/c.h')
-rw-r--r-- | src/include/c.h | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/src/include/c.h b/src/include/c.h index fb305e80b93..7168113c56e 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1067,13 +1067,40 @@ extern int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_p extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args); #endif -#if defined(HAVE_LONG_LONG_INT) && defined(HAVE_STRTOLL) && !HAVE_DECL_STRTOLL +#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC +extern int fdatasync(int fildes); +#endif + +#ifdef HAVE_LONG_LONG_INT +/* Older platforms may provide strto[u]ll functionality under other names */ +#if !defined(HAVE_STRTOLL) && defined(HAVE___STRTOLL) +#define strtoll __strtoll +#define HAVE_STRTOLL 1 +#endif + +#if !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ) +#define strtoll strtoq +#define HAVE_STRTOLL 1 +#endif + +#if !defined(HAVE_STRTOULL) && defined(HAVE___STRTOULL) +#define strtoull __strtoull +#define HAVE_STRTOULL 1 +#endif + +#if !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ) +#define strtoull strtouq +#define HAVE_STRTOULL 1 +#endif + +#if defined(HAVE_STRTOLL) && !HAVE_DECL_STRTOLL extern long long strtoll(const char *str, char **endptr, int base); #endif -#if defined(HAVE_LONG_LONG_INT) && defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL +#if defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL extern unsigned long long strtoull(const char *str, char **endptr, int base); #endif +#endif /* HAVE_LONG_LONG_INT */ #if !defined(HAVE_MEMMOVE) && !defined(memmove) #define memmove(d, s, c) bcopy(s, d, c) @@ -1111,22 +1138,6 @@ extern unsigned long long strtoull(const char *str, char **endptr, int base); #define siglongjmp longjmp #endif -#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC -extern int fdatasync(int fildes); -#endif - -/* If strtoq() exists, rename it to the more standard strtoll() */ -#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ) -#define strtoll strtoq -#define HAVE_STRTOLL 1 -#endif - -/* If strtouq() exists, rename it to the more standard strtoull() */ -#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ) -#define strtoull strtouq -#define HAVE_STRTOULL 1 -#endif - /* * We assume if we have these two functions, we have their friends too, and * can use the wide-character functions. |