Update of /cvsroot/pypgsql/pypgsql/port
In directory usw-pr-cvs1:/tmp/cvs-serv14188
Modified Files:
port.h strtoll.c strtoull.c
Log Message:
01OCT2002 gh Don't guess about the limits of (unsigned) long longs. If
HAVE_LONG_LONG and all required constants are defined by
including limits.h, then define HAVE_LONG_LONG_SUPPORT.
Index: port.h
===================================================================
RCS file: /cvsroot/pypgsql/pypgsql/port/port.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** port.h 16 Sep 2002 05:28:14 -0000 1.1
--- port.h 2 Oct 2002 03:55:24 -0000 1.2
***************
*** 6,9 ****
--- 6,10 ----
**********************************************************************/
#include <limits.h>
+ #include "Python.h"
#ifdef MS_WIN32
***************
*** 19,32 ****
#endif /* MS_WIN32 */
! /* Some braindead combinations of compilers don't get the constants defined,
! * for example gcc 2.95.x and Linux glibc. We do their work for them: */
! #if !defined(LLONG_MAX)
! #define LL_LITERAL(x) x##LL
! #define ULL_LITERAL(x) x##ULL
!
! #define ULLONG_MAX (~ULL_LITERAL(0))
! #define LLONG_MAX (ULLONG_MAX/2)
! #define LLONG_MIN (-(ULLONG_MAX/2)+1)
! #endif /* !defined(LLONG_MAX) */
/*******************************************************
--- 20,32 ----
#endif /* MS_WIN32 */
! /* There are compiler/platform combinations that HAVE_LONG_LONG, but don't
! * provide the respective constants by default. Examples are Linux glibc and
! * Cygwin. Only define HAVE_LONG_LONG_SUPPORT if both conditions are
! * fulfilled.
! */
! #if defined(HAVE_LONG_LONG) && defined(LLONG_MAX) && defined(ULLONG_MAX) \
! && defined(LLONG_MIN)
! #define HAVE_LONG_LONG_SUPPORT
! #endif
/*******************************************************
***************
*** 37,41 ****
--- 37,44 ----
char * pg_strtok(char *s, const char *delim);
+ #if defined(HAVE_LONG_LONG_SUPPORT)
LONG_LONG pg_strtoll(const char *nptr, char **endptr, register int base);
unsigned LONG_LONG pg_strtoull(const char *nptr, char **endptr, register int base);
+ #endif
+
#endif /* !defined(PYPGSQL_COMPAT_H) */
Index: strtoll.c
===================================================================
RCS file: /cvsroot/pypgsql/pypgsql/port/strtoll.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** strtoll.c 16 Sep 2002 05:28:14 -0000 1.1
--- strtoll.c 2 Oct 2002 03:55:24 -0000 1.2
***************
*** 51,54 ****
--- 51,55 ----
#include "port.h"
+ #if defined(HAVE_LONG_LONG_SUPPORT)
/*
* Convert a string to a LONG_LONG integer.
***************
*** 142,143 ****
--- 143,145 ----
return (acc);
}
+ #endif
Index: strtoull.c
===================================================================
RCS file: /cvsroot/pypgsql/pypgsql/port/strtoull.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** strtoull.c 16 Sep 2002 05:28:14 -0000 1.1
--- strtoull.c 2 Oct 2002 03:55:24 -0000 1.2
***************
*** 51,54 ****
--- 51,55 ----
#include "port.h"
+ #if defined(HAVE_LONG_LONG_SUPPORT)
/*
* Convert a string to an unsigned LONG_LONG integer.
***************
*** 120,121 ****
--- 121,123 ----
return (acc);
}
+ #endif
|