[Git][NTPsec/ntpsec][master] 11 commits: ascii.h: remove many unused defines.

Gary E. Miller gitlab at mg.gitlab.com
Tue May 23 21:04:18 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
f22bac2f by Gary E. Miller at 2017-05-23T13:01:41-07:00
ascii.h: remove many unused defines.

- - - - -
2b21ea90 by Gary E. Miller at 2017-05-23T13:11:35-07:00
mbg_gps166: remove unused SYNTH stuff.

- - - - -
8e8cfd69 by Gary E. Miller at 2017-05-23T13:17:47-07:00
mbg_gps166: remove unused header cruft.

- - - - -
0f1c7607 by Gary E. Miller at 2017-05-23T13:26:13-07:00
mbg_gps166: remove unused macro

- - - - -
40d0bfb9 by Gary E. Miller at 2017-05-23T13:26:36-07:00
ntp_assert: remove Calypso support.

calypso is a closed source project with no public binaries or other
access.  No way NTPsec can use it.  Unmaintained since 2011.

- - - - -
86b90d51 by Gary E. Miller at 2017-05-23T13:35:13-07:00
tests; remove duplicate is_leapyear()

- - - - -
9b790cca by Gary E. Miller at 2017-05-23T13:42:33-07:00
ntpd.h: remove unused define.

- - - - -
4759fa85 by Gary E. Miller at 2017-05-23T13:45:21-07:00
ntp_control: make ctlsysstatus() static.

- - - - -
2cbc1530 by Gary E. Miller at 2017-05-23T13:54:57-07:00
ntpd.h: remove unused define.

- - - - -
a81f3b40 by Gary E. Miller at 2017-05-23T13:59:22-07:00
ntp_io: remove unused interface_enumerate()

- - - - -
31ff7bda by Gary E. Miller at 2017-05-23T14:01:58-07:00
ntp_io: make findbcastinter() static.

- - - - -


7 changed files:

- include/ascii.h
- include/mbg_gps166.h
- include/ntp_assert.h
- include/ntpd.h
- ntpd/ntp_control.c
- ntpd/ntp_io.c
- tests/check_y2k.c


Changes:

=====================================
include/ascii.h
=====================================
--- a/include/ascii.h
+++ b/include/ascii.h
@@ -12,39 +12,10 @@
  * just name the common ASCII control codes
  */
 #define NUL	  0
-#define SOH	  1
 #define STX	  2
 #define ETX	  3
-#define EOT	  4
-#define ENQ	  5
-#define ACK	  6
-#define BEL	  7
-#define BS	  8
-#define HT	  9
-#define NL	 10
-#define VT	 11
-#define NP	 12
-#define CR	 13
-#define SO	 14
-#define SI	 15
+#define SOH	  1
 #define DLE	 16
-#define DC1	 17
-#define DC2	 18
-#define DC3	 19
-#define DC4	 20
-#define NAK	 21
-#define SYN	 22
-#define ETB	 23
-#define CAN	 24
-#define EM	 25
-#define SUB	 26
-#define ESC	 27
-#define FS	 28
-#define GS	 29
-#define RS	 30
-#define US	 31
-#define SP	 32
-#define DEL	127
 
 #endif
 /*


=====================================
include/mbg_gps166.h
=====================================
--- a/include/mbg_gps166.h
+++ b/include/mbg_gps166.h
@@ -56,46 +56,6 @@
  */
 #define GPS_SEC_BIAS   315964800UL     // ( ( ( 10UL * 365UL ) + 2 + 5 ) * SECS_PER_DAY )
 
-
-/**
- * @brief A data type to configure a serial port's baud rate
- *
- * @see ::MBG_BAUD_RATES
- */
-typedef int32_t BAUD_RATE;
-
-/**
- * @brief A structure to store the configuration of a serial port
- */
-typedef struct
-{
-  BAUD_RATE baud_rate;  ///< transmission speed, e.g. 19200L, see ::MBG_BAUD_RATES
-  char framing[4];      ///< ASCIIZ framing string, e.g. "8N1" or "7E2", see ::MBG_FRAMING_STRS
-  int16_t handshake;    ///< handshake mode, yet only ::HS_NONE supported
-
-} COM_PARM;
-
-
-/**
- * @brief Enumeration of modes supported for time string transmission
- *
- * This determines e.g. at which point in time a string starts
- * to be transmitted via the serial port.
- * Used with ::PORT_SETTINGS::mode.
- *
- * @see ::STR_MODE_MASKS
- */
-enum STR_MODES
-{
-  STR_ON_REQ,     ///< transmission on request by received '?' character only
-  STR_PER_SEC,    ///< transmission automatically if second changes
-  STR_PER_MIN,    ///< transmission automatically if minute changes
-  STR_AUTO,       ///< transmission automatically if required, e.g. on capture event
-  STR_ON_REQ_SEC, ///< transmission if second changes and a request has been received before
-  N_STR_MODE      ///< the number of known modes
-};
-
-
 /**
  * @brief The type of a GPS command code
  *
@@ -103,20 +63,6 @@ enum STR_MODES
  */
 typedef uint16_t GPS_CMD;
 
-
-/**
- * @brief Control codes to be or'ed with a particular command/type code
- */
-enum GPS_CMD_CTRL_CODES
-{
-  GPS_REQACK = 0x8000,   ///< to device: request acknowledge
-  GPS_ACK    = 0x4000,   ///< from device: acknowledge a command
-  GPS_NACK   = 0x2000,   ///< from device: error evaluating a command
-};
-
-#define GPS_CTRL_MSK  0xF000   ///< bit mask of all ::GPS_CMD_CTRL_CODES
-
-
 /**
  * @brief Command codes for the binary protocol
  *
@@ -242,9 +188,6 @@ typedef uint16_t IOD;     ///< Issue-Of-Data code
  */
 typedef uint16_t BVAR_STAT;
 
-#define _mbg_swab_bvar_stat( _p )  _mbg_swab16( (_p) )
-
-
 /**
  * @brief Enumeration of flag bits used to define ::BVAR_FLAGS
  *
@@ -453,120 +396,6 @@ typedef l_fp LLA[N_LLA];
 
 
 /**
- * @defgroup group_synth Synthesizer parameters
- *
- * Synthesizer frequency is expressed as a
- * four digit decimal number (freq) to be multiplied by 0.1 Hz and an
- * base 10 exponent (range). If the effective frequency is less than
- * 10 kHz its phase is synchronized corresponding to the variable phase.
- * Phase may be in a range from -360 deg to +360 deg with a resolution
- * of 0.1 deg, so the resulting numbers to be stored are in a range of
- * -3600 to +3600.
- *
- * Example:<br>
- * Assume the value of freq is 2345 (decimal) and the value of phase is 900.
- * If range == 0 the effective frequency is 234.5 Hz with a phase of +90 deg.
- * If range == 1 the synthesizer will generate a 2345 Hz output frequency
- * and so on.
- *
- * Limitations:<br>
- * If freq == 0 the synthesizer is disabled. If range == 0 the least
- * significant digit of freq is limited to 0, 3, 5 or 6. The resulting
- * frequency is shown in the examples below:
- *    - freq == 1230  -->  123.0 Hz
- *    - freq == 1233  -->  123 1/3 Hz (real 1/3 Hz, NOT 123.3 Hz)
- *    - freq == 1235  -->  123.5 Hz
- *    - freq == 1236  -->  123 2/3 Hz (real 2/3 Hz, NOT 123.6 Hz)
- *
- * If range == ::MAX_SYNTH_RANGE the value of freq must not exceed 1000, so
- * the output frequency is limited to 10 MHz (see ::MAX_SYNTH_FREQ_VAL).
- *
- * @{ */
-
-#define N_SYNTH_FREQ_DIGIT  4    ///< number of digits to edit
-#define MAX_SYNTH_FREQ   1000    ///< if range == ::MAX_SYNTH_RANGE
-
-#define MIN_SYNTH_RANGE     0
-#define MAX_SYNTH_RANGE     5
-#define N_SYNTH_RANGE       ( MAX_SYNTH_RANGE - MIN_SYNTH_RANGE + 1 )
-
-#define N_SYNTH_PHASE_DIGIT  4
-#define MAX_SYNTH_PHASE      3600
-
-
-#define MAX_SYNTH_FREQ_EDIT  9999  ///< max sequence of digits when editing
-
-
-/**
- * @brief The maximum frequency that can be configured for the synthesizer
- */
-#define MAX_SYNTH_FREQ_VAL   10000000UL     ///< 10 MHz
-/*   == MAX_SYNTH_FREQ * 10^(MAX_SYNTH_RANGE-1) */
-
-/**
- * A Macro used to determine the position of the decimal point
- * when printing the synthesizer frequency as 4 digit value
- */
-#define _synth_dp_pos_from_range( _r ) \
-  ( ( ( N_SYNTH_RANGE - (_r) ) % ( N_SYNTH_FREQ_DIGIT - 1 ) ) + 1 )
-
-/**
- * @brief Synthesizer frequency units
- *
- * An initializer for commonly displayed synthesizer frequency units
- * (::N_SYNTH_RANGE strings)
- */
-#define DEFAULT_FREQ_RANGES \
-{                           \
-  "Hz",                     \
-  "kHz",                    \
-  "kHz",                    \
-  "kHz",                    \
-  "MHz",                    \
-  "MHz",                    \
-}
-
-
-
-/**
- * @brief Synthesizer configuration parameters
- */
-typedef struct
-{
-  int16_t freq;    ///< four digits used; scale: 0.1 Hz; e.g. 1234 -> 123.4 Hz
-  int16_t range;   ///< scale factor for freq; 0..::MAX_SYNTH_RANGE
-  int16_t phase;   ///< -::MAX_SYNTH_PHASE..+::MAX_SYNTH_PHASE; >0 -> pulses later
-
-} SYNTH;
-
-/**
- * @brief Enumeration of synthesizer states
- */
-enum SYNTH_STATES
-{
-  SYNTH_DISABLED,   ///< disbled by cfg, i.e. freq == 0.0
-  SYNTH_OFF,        ///< not enabled after power-up
-  SYNTH_FREE,       ///< enabled, but not synchronized
-  SYNTH_DRIFTING,   ///< has initially been sync'd, but now running free
-  SYNTH_SYNC,       ///< fully synchronized
-  N_SYNTH_STATE     ///< the number of known states
-};
-
-
-/**
- * @brief A structure used to report the synthesizer state
- */
-typedef struct
-{
-  uint8_t state;     ///< state code as enumerated in ::SYNTH_STATES
-  uint8_t flags;     ///< reserved, currently always 0
-
-} SYNTH_STATE;
-
-/** @} defgroup group_synth */
-
-
-/**
  * @brief The name of a time zone
  *
  * @note Up to 5 printable characters, plus trailing zero


=====================================
include/ntp_assert.h
=====================================
--- a/include/ntp_assert.h
+++ b/include/ntp_assert.h
@@ -29,17 +29,7 @@
 
 #include <stdbool.h>
 
-# ifdef CALYSTO 
-/* see: http://www.domagoj-babic.com/index.php/ResearchProjects/Calysto */
-
-extern void calysto_assume(unsigned char cnd); /* assume this always holds */ 
-extern void calysto_assert(unsigned char cnd); /* check whether this holds */ 
-#define ALWAYS_REQUIRE(x)	calysto_assert(x)
-#define ALWAYS_INSIST(x)	calysto_assume(x) /* DLH calysto_assert()? */
-#define ALWAYS_INVARIANT(x)	calysto_assume(x)
-#define ALWAYS_ENSURE(x)	calysto_assert(x)
-
-/* # elif defined(__COVERITY__) */
+/* # if defined(__COVERITY__) */
 /*
  * DH: try letting coverity scan our actual assertion macros, now that
  * isc_assertioncallback_t is marked __attribute__ __noreturn__.
@@ -53,15 +43,7 @@ extern void calysto_assert(unsigned char cnd); /* check whether this holds */
  * that seems to be a reasonable trade-off.
  */
 
-/*
-#define ALWAYS_REQUIRE(x)	assert(x)
-#define ALWAYS_INSIST(x)	assert(x)
-#define ALWAYS_INVARIANT(x)	assert(x)
-#define ALWAYS_ENSURE(x)	assert(x)
-*/
-
-
-#elif defined(__FLEXELINT__)
+#if defined(__FLEXELINT__)
 
 #include <assert.h>
 
@@ -70,7 +52,7 @@ extern void calysto_assert(unsigned char cnd); /* check whether this holds */
 #define ALWAYS_INVARIANT(x)	assert(x)
 #define ALWAYS_ENSURE(x)	assert(x)
 
-# else	/* neither Calysto, Coverity or FlexeLint */
+# else	/* not FlexeLint */
 
 #include "isc/assertions.h"
 
@@ -79,7 +61,7 @@ extern void calysto_assert(unsigned char cnd); /* check whether this holds */
 #define ALWAYS_INVARIANT(x)	ISC_INVARIANT(x)
 #define ALWAYS_ENSURE(x)	ISC_ENSURE(x)
 
-# endif /* neither Coverity nor Calysto */
+# endif /* not FlexeLint */
 
 #define	REQUIRE(x)		ALWAYS_REQUIRE(x)
 #define	INSIST(x)		ALWAYS_INSIST(x)


=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -60,13 +60,10 @@
 
 
 /* ntp_config.c */
-#define	TAI_1972	10	/* initial TAI offset (s) */
-
 extern	const char	*getconfig	(const char *);
 extern	void	readconfig(const char *);
 extern	void	ctl_clr_stats	(void);
 extern	u_short ctlpeerstatus	(struct peer *);
-extern	u_short ctlsysstatus	(void);
 extern	void	init_control	(void);
 extern	void	process_control (struct recvbuf *, int);
 extern	void	report_event	(int, struct peer *, const char *);
@@ -94,7 +91,6 @@ struct ctl_var {
 #define	EOV		0x80
 
 #define	RO	(CAN_READ)
-#define	WO	(CAN_WRITE)
 #define	RW	(CAN_READ|CAN_WRITE)
 
 extern	char *	add_var (struct ctl_var **, u_long, u_short);
@@ -112,12 +108,10 @@ typedef struct interface_info {
 typedef void	(*interface_receiver_t)	(void *, interface_info_t *);
 
 extern  bool listen_to_virtual_ips;
-extern	void	interface_enumerate	(interface_receiver_t, void *);
 extern	endpt *	getinterface		(sockaddr_u *, uint32_t);
 extern	endpt *	select_peerinterface	(struct peer *, sockaddr_u *,
 					 endpt *);
 extern	endpt *	findinterface		(sockaddr_u *);
-extern	endpt *	findbcastinter		(sockaddr_u *);
 extern	void	enable_broadcast	(endpt *, sockaddr_u *);
 extern	void	interface_update	(interface_receiver_t, void *);
 extern  void    io_handler              (void);


=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -75,6 +75,7 @@ static	void	ctl_putclock	(int, struct refclockstat *, int);
 #endif	/* REFCLOCK */
 static	const struct ctl_var *ctl_getitem(const struct ctl_var *,
 					  char **);
+static	u_short ctlsysstatus	(void);
 static	u_short	count_var	(const struct ctl_var *);
 static	void	control_unspec	(struct recvbuf *, int);
 static	void	read_status	(struct recvbuf *, int);
@@ -914,7 +915,7 @@ ctlclkstatus(
 /*
  * ctlsysstatus - return the system status word
  */
-u_short
+static u_short
 ctlsysstatus(void)
 {
 	register uint8_t this_clock;


=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -234,6 +234,8 @@ static void	add_addr_to_list	(sockaddr_u *, endpt *);
 static void	create_wildcards	(u_short);
 static endpt *	findlocalinterface	(sockaddr_u *, int, int);
 static endpt *	findclosestinterface	(sockaddr_u *, int);
+static endpt *	findbcastinter		(sockaddr_u *);
+
 #ifdef DEBUG
 static const char *	action_text	(nic_rule_action);
 #endif
@@ -644,22 +646,6 @@ is_ip_address(
 
 
 /*
- * interface list enumerator - visitor pattern
- */
-void
-interface_enumerate(
-	interface_receiver_t	receiver,
-	void *			data
-	)
-{
-	interface_info_t ifi;
-
-	ifi.action = IFS_EXISTS;
-	for (ifi.ep = ep_list; ifi.ep != NULL; ifi.ep = ifi.ep->elink)
-		(*receiver)(data, &ifi);
-}
-
-/*
  * do standard initialization of interface structure
  */
 static void
@@ -2903,7 +2889,7 @@ getinterface(
 /*
  * findbcastinter - find broadcast interface corresponding to address
  */
-endpt *
+static endpt *
 findbcastinter(
 	sockaddr_u *addr
 	)


=====================================
tests/check_y2k.c
=====================================
--- a/tests/check_y2k.c
+++ b/tests/check_y2k.c
@@ -238,8 +238,7 @@ main( void )
     puts( " include/ntp_calendar.h" );
   {		/* I believe this is good, but just to be sure... */
 
-	/* we are testing this #define */
-#define is_leapyear(y) (y%4 == 0 && !(y%100 == 0 && !(y%400 == 0)))
+    /* we are testing #define is_leapyear(y) */
 
     for ( year = 1400; year <= 2200; year++ )
     {



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/988e009cb059c17fdc1e38256174f90268c027fe...31ff7bdacdd02d50a0c946a848e7d15fae460232

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/988e009cb059c17fdc1e38256174f90268c027fe...31ff7bdacdd02d50a0c946a848e7d15fae460232
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170523/8809a96b/attachment.html>


More information about the vc mailing list