mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Fix for no platform NAN.
This commit is contained in:
parent
da361ee24b
commit
d8ae7ffb2f
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.3 1998/10/22 13:16:25 momjian Exp $";
|
static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.4 1999/01/01 04:17:13 momjian Exp $";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -189,7 +189,6 @@ inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
|
|||||||
char *odst = dst;
|
char *odst = dst;
|
||||||
char *t;
|
char *t;
|
||||||
size_t len = 4;
|
size_t len = 4;
|
||||||
u_int m;
|
|
||||||
int b, tb;
|
int b, tb;
|
||||||
|
|
||||||
if (bits < 0 || bits > 32)
|
if (bits < 0 || bits > 32)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* is for IP V4 CIDR notation, but prepared for V6: just
|
* is for IP V4 CIDR notation, but prepared for V6: just
|
||||||
* add the necessary bits where the comments indicate.
|
* add the necessary bits where the comments indicate.
|
||||||
*
|
*
|
||||||
* $Id: network.c,v 1.4 1998/10/29 16:13:07 tgl Exp $
|
* $Id: network.c,v 1.5 1999/01/01 04:17:13 momjian Exp $
|
||||||
* Jon Postel RIP 16 Oct 1998
|
* Jon Postel RIP 16 Oct 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -389,8 +389,7 @@ network_network(inet *ip)
|
|||||||
{
|
{
|
||||||
text *ret;
|
text *ret;
|
||||||
int len;
|
int len;
|
||||||
char *ptr,
|
char tmp[sizeof("255.255.255.255/32")];
|
||||||
tmp[sizeof("255.255.255.255/32")];
|
|
||||||
|
|
||||||
if (ip_family(ip) == AF_INET)
|
if (ip_family(ip) == AF_INET)
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* 1998 Jan Wieck
|
* 1998 Jan Wieck
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.2 1998/12/30 20:46:05 wieck Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.3 1999/01/01 04:17:13 momjian Exp $
|
||||||
*
|
*
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <nan.h>
|
/*#include <nan.h> BSD/OS does not have this */
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
@ -1723,7 +1723,11 @@ numeric_float8(Numeric num)
|
|||||||
if (NUMERIC_IS_NAN(num))
|
if (NUMERIC_IS_NAN(num))
|
||||||
{
|
{
|
||||||
result = (float64)palloc(sizeof(float64data));
|
result = (float64)palloc(sizeof(float64data));
|
||||||
|
#ifdef NAN
|
||||||
*result = NAN;
|
*result = NAN;
|
||||||
|
#else
|
||||||
|
*result = num;
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1773,7 +1777,11 @@ numeric_float4(Numeric num)
|
|||||||
if (NUMERIC_IS_NAN(num))
|
if (NUMERIC_IS_NAN(num))
|
||||||
{
|
{
|
||||||
result = (float32)palloc(sizeof(float32data));
|
result = (float32)palloc(sizeof(float32data));
|
||||||
|
#ifdef NAN
|
||||||
*result = NAN;
|
*result = NAN;
|
||||||
|
#else
|
||||||
|
*result = num;
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user