[Git][NTPsec/ntpsec][master] 5 commits: remove unused defines
Gary E. Miller
gitlab at mg.gitlab.com
Sun Feb 19 22:58:16 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
d334315b by Gary E. Miller at 2017-02-19T14:31:02-08:00
remove unused defines
- - - - -
0e3133da by Gary E. Miller at 2017-02-19T14:33:39-08:00
Move 3 odd defines from global to local.
- - - - -
ab61a9de by Gary E. Miller at 2017-02-19T14:39:50-08:00
remove unused defines, and a test for a deine.
Why test an unused function?
- - - - -
8e146ce0 by Gary E. Miller at 2017-02-19T14:44:58-08:00
Move 2 global defines to the local where they are used.
- - - - -
53e362bd by Gary E. Miller at 2017-02-19T14:57:36-08:00
Remove unused defines, move some global defines to local.
- - - - -
4 changed files:
- include/ntp.h
- ntpd/ntp_config.c
- ntpd/ntp_proto.c
- tests/check_y2k.c
Changes:
=====================================
include/ntp.h
=====================================
--- a/include/ntp.h
+++ b/include/ntp.h
@@ -49,28 +49,12 @@ typedef unsigned int u_int;
400)) : 0))
/*
- * Number of days since start of NTP time to 1 January of given year
- */
-#define ntp0(year) (julian0(year) - julian0(1900))
-
-/*
- * Number of days since start of UNIX time to 1 January of given year
- */
-#define unix0(year) (julian0(year) - julian0(1970))
-
-/*
* LEAP YEAR test for full 4-digit years (e.g, 1999, 2010)
*/
#define isleap_4(y) ((y) % 4 == 0 && !((y) % 100 == 0 && !(y % \
400 == 0)))
/*
- * LEAP YEAR test for tm_year (struct tm) years (e.g, 99, 110)
- */
-#define isleap_tm(y) ((y) % 4 == 0 && !((y) % 100 == 0 && !(((y) \
- + 1900) % 400 == 0)))
-
-/*
* to convert simple two-digit years to tm_year style years:
*
* if (year < YEAR_PIVOT)
@@ -109,25 +93,15 @@ typedef unsigned int u_int;
#define NTP_MINPKT 2 /* guard time (s) */
/*
- * Clock filter algorithm tuning parameters
+ * Clock filter algorithm tuning parameter
*/
-#define MAXDISPERSE 16. /* max dispersion */
#define NTP_SHIFT 8 /* clock filter stages */
-#define NTP_FWEIGHT .5 /* clock filter weight */
/*
* Selection algorithm tuning parameters
*/
-#define NTP_MINCLOCK 3 /* min survivors */
-#define NTP_MAXCLOCK 10 /* max candidates */
-#define MINDISPERSE .001 /* min distance */
#define MAXDISTANCE 1.5 /* max root distance (select threshold) */
-#define CLOCK_SGATE 3. /* popcorn spike gate */
#define HUFFPUFF 900 /* huff-n'-puff sample interval (s) */
-#define MAXHOP 2 /* anti-clockhop threshold */
-#define MAX_TTL 8 /* max ttl mapping vector size */
-#define NTP_MAXEXTEN 2048 /* max extension field size */
-#define NTP_ORPHWAIT 300 /* orphan wair (s) */
/*
* Miscellaneous stuff
@@ -137,7 +111,6 @@ typedef unsigned int u_int;
* Limits of things
*/
#define MAXFILENAME 256 /* max length of file name */
-#define MAXHOSTNAME 512 /* max length of host/node name */
#define NTP_MAXSTRLEN 256 /* max string length */
/*
@@ -153,9 +126,7 @@ typedef unsigned int u_int;
*/
#define SQUARE(x) ((x) * (x))
#define SQRT(x) (sqrt(x))
-#define DIFF(x, y) (SQUARE((x) - (y)))
#define LOGTOD(a) ldexp(1., (int)(a)) /* log2 to double */
-#define UNIVAR(x) (SQUARE(.28867513 * LOGTOD(x))) /* std uniform distr */
#define ULOGTOD(a) ldexp(1., (int)(a)) /* ulog2 to double */
#define EVENT_TIMEOUT 0 /* one second, that is */
@@ -435,17 +406,6 @@ struct peer {
#define FLAG_TRUE 0x0400 /* force truechimer */
#define FLAG_TSTAMP_PPS 0x4cd000 /* PPS source provides absolute timestamp */
-/*
- * Definitions for the clear() routine. We use memset() to clear
- * the parts of the peer structure which go to zero. These are
- * used to calculate the start address and length of the area.
- */
-#define CLEAR_TO_ZERO(p) ((char *)&((p)->clear_to_zero))
-#define END_CLEAR_TO_ZERO(p) ((char *)&((p)->end_clear_to_zero))
-#define LEN_CLEAR_TO_ZERO(p) (END_CLEAR_TO_ZERO(p) - CLEAR_TO_ZERO(p))
-#define CRYPTO_TO_ZERO(p) ((char *)&((p)->clear_to_zero))
-#define END_CRYPTO_TO_ZERO(p) ((char *)&((p)->end_clear_to_zero))
-#define LEN_CRYPTO_TO_ZERO (END_CRYPTO_TO_ZERO((struct peer *)0) \
/*
* It's ugly that refid is sometimes treated as a uint32_t and sometimes
=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -52,6 +52,11 @@
#endif
/*
+ * Selection algorithm tuning parameters
+ */
+#define MAX_TTL 8 /* max ttl mapping vector size */
+
+/*
* In the past, we told reference clocks from network peers by giving
* the reference clocks magic address of a particular special form
* ntpd itself, the filtering that used to be done based on this magic
=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -18,16 +18,42 @@
#include <unistd.h>
/*
+ * Definitions for the clear() routine. We use memset() to clear
+ * the parts of the peer structure which go to zero. These are
+ * used to calculate the start address and length of the area.
+ */
+#define CLEAR_TO_ZERO(p) ((char *)&((p)->clear_to_zero))
+#define END_CLEAR_TO_ZERO(p) ((char *)&((p)->end_clear_to_zero))
+#define LEN_CLEAR_TO_ZERO(p) (END_CLEAR_TO_ZERO(p) - CLEAR_TO_ZERO(p))
+
+/*
* traffic shaping parameters
*/
#define NTP_IBURST 6 /* packets in iburst */
#define RESP_DELAY 1 /* refclock burst delay (s) */
/*
+ * Clock filter algorithm tuning parameters
+ */
+#define MAXDISPERSE 16. /* max dispersion */
+#define NTP_FWEIGHT .5 /* clock filter weight */
+
+/*
+ * Selection algorithm tuning parameters
+ */
+#define NTP_MINCLOCK 3 /* min survivors */
+#define NTP_MAXCLOCK 10 /* max candidates */
+#define MINDISPERSE .001 /* min distance */
+#define CLOCK_SGATE 3. /* popcorn spike gate */
+#define NTP_ORPHWAIT 300 /* orphan wair (s) */
+
+/*
* pool soliciting restriction duration (s)
*/
#define POOL_SOLICIT_WINDOW 8
+#define DIFF(x, y) (SQUARE((x) - (y)))
+
/*
* peer_select groups statistics for a peer used by clock_select() and
* clock_cluster().
=====================================
tests/check_y2k.c
=====================================
--- a/tests/check_y2k.c
+++ b/tests/check_y2k.c
@@ -200,12 +200,6 @@ main( void )
fprintf( stdout, "isleap_4(1999) REPORTED TRUE\n" );
exit(2);
}
-
- if ( !isleap_tm(2000-1900) )
- {
- fprintf( stdout, "isleap_tm(100) REPORTED FALSE\n" );
- exit(2);
- }
}
Fatals = Warnings = 0;
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/50ace12dd011b3aa138543c9cca31bc40bdfa5cd...53e362bddcfa4754944548fa79d4d50e0d315570
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170219/e25f17b1/attachment.html>
More information about the vc
mailing list