[ntpsec commit] Move the Windows redirect of strerror() to the Windows config.h...
Eric S. Raymond
esr at ntpsec.org
Wed Sep 30 20:22:41 UTC 2015
Module: ntpsec
Branch: master
Commit: 7e69403c2c657f0c5e58a7545971f6311258aa47
Changeset: http://git.ntpsec.org/ntpsec/commit/?id=7e69403c2c657f0c5e58a7545971f6311258aa47
Author: Eric S. Raymond <esr at thyrsus.com>
Date: Wed Sep 30 16:21:00 2015 -0400
Move the Windows redirect of strerror() to the Windows config.h...
...so we don't need a guard symbol and the macro cluttering the Unix code.
---
include/ntp_stdlib.h | 16 ----------------
ports/winnt/include/config.h | 3 ++-
2 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/include/ntp_stdlib.h b/include/ntp_stdlib.h
index a95c9cb..8d36c34 100644
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -256,22 +256,6 @@ extern size_t strlcpy(char *dst, const char *src, size_t siz);
extern size_t strlcat(char *dst, const char *src, size_t siz);
#endif
-
-
-/* lib/isc/win32/strerror.c
- *
- * To minimize Windows-specific changes to the rest of the NTP code,
- * particularly reference clocks, we hijack calls to strerror() to deal
- * with our mixture of error codes from the C runtime (open, write)
- * and Windows (sockets, serial ports). This is an ugly hack because
- * both use the lowest values differently, but particularly for ntpd,
- * it's not a problem.
- */
-#ifdef NTP_REDEFINE_STRERROR
-#define strerror(e) ntp_strerror(e)
-extern char * ntp_strerror (int e);
-#endif
-
/* systime.c */
extern double sys_tick; /* tick size or time to read */
extern double measured_tick; /* non-overridable sys_tick */
diff --git a/ports/winnt/include/config.h b/ports/winnt/include/config.h
index ef23560..47ec5a2 100644
--- a/ports/winnt/include/config.h
+++ b/ports/winnt/include/config.h
@@ -325,7 +325,8 @@ typedef int ssize_t; /* ssize is an int */
* both use the lowest values differently, but particularly for ntpd,
* it's not a problem.
*/
-#define NTP_REDEFINE_STRERROR
+#define strerror(e) ntp_strerror(e)
+extern char * ntp_strerror (int e);
#define MCAST /* Enable Multicast Support */
#define MULTICAST_NONEWSOCKET /* Don't create a new socket for mcast address */
More information about the vc
mailing list