diff options
author | Fred Wright <fw@fwright.net> | 2019-03-13 19:37:33 -0700 |
---|---|---|
committer | Fred Wright <fw@fwright.net> | 2019-03-18 19:41:03 -0700 |
commit | 7722705676a8c7d52c612057de241167459b9e33 (patch) | |
tree | 296d3571ee331788cb48ad9c30da53f49c296169 /driver_tsip.c | |
parent | 68d54c2dac8e2d082f0326cdcf56c31e70203300 (diff) | |
download | gpsd-7722705676a8c7d52c612057de241167459b9e33.tar.gz |
Avoids troublesome dependency on M_LN2 from math.h.
The M_LN2 definition isn't always provided by math.h, depending on the
settings of the pesky configure flags. Since ln(2) is a mathematical
constant, there's no loss of generality in defining our own version,
and that decouples us from the variability.
Since the stated purpose of defining _XOPEN_SOURCE in driver_tsip.c
and driver_zodiac.c is just to make M_LN2 available, this is
no longer necessary.
TESTED:
(With subsequent fixes included) Ran "build-all check" on Mac Pro
10.9, Mac Pro 10.14, MacBook Pro 10.9, PowerBook 10.5, VMs for OSX
10.5-10.13, Ubuntu 14.04, CentOS 7, Fedora 25, FreeBSD 10.3, OpenBSD
5.6, OpenBSD 5.6 32-bit, NetBSD 6.1.5, and Beaglebone (arm) Debian 7.
Diffstat (limited to 'driver_tsip.c')
-rw-r--r-- | driver_tsip.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/driver_tsip.c b/driver_tsip.c index 55010584..0add16ba 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -13,13 +13,6 @@ * SPDX-License-Identifier: BSD-2-clause */ -#ifdef __linux__ -/* FreeBSD chokes on this */ -/* if we insist on C99, then we need this to get M_LN2 from math.h */ -/* 500 mean X/Open 1995 */ -#define _XOPEN_SOURCE 500 -#endif /* __linux__ */ - #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L /* round() needs _POSIX_C_SOURCE >= 200112L */ #define _POSIX_C_SOURCE 200112L @@ -1186,7 +1179,7 @@ static bool tsip_speed_switch(struct gps_device_t *session, } putbyte(buf, 0, 0xff); /* current port */ - putbyte(buf, 1, (round(log((double)speed / 300) / M_LN2)) + 2); /* input dev.baudrate */ + putbyte(buf, 1, (round(log((double)speed / 300) / GPS_LN2)) + 2); /* input dev.baudrate */ putbyte(buf, 2, getub(buf, 1)); /* output baudrate */ putbyte(buf, 3, 3); /* character width (8 bits) */ putbyte(buf, 4, parity); /* parity (normally odd) */ |