[Git][NTPsec/ntpsec][master] Address GitLab issue #388: Remove 'register' keyword

Eric S. Raymond gitlab at mg.gitlab.com
Fri Sep 15 20:30:09 UTC 2017


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
f0bf5b0e by Eric S. Raymond at 2017-09-15T20:29:45Z
Address GitLab issue #388: Remove 'register' keyword

C11 deprecated it, C17 removes it, and it has been a long time since
the usual compilers needed it.

- - - - -


17 changed files:

- libntp/authreadkeys.c
- libntp/hextolfp.c
- libntp/numtoa.c
- libntp/recvbuff.c
- libparse/clk_rcc8000.c
- libparse/clk_trimtsip.c
- libparse/parse.c
- ntpd/ntp_control.c
- ntpd/ntp_io.c
- ntpd/refclock_arbiter.c
- ntpd/refclock_hpgps.c
- ntpd/refclock_magnavox.c
- ntpd/refclock_oncore.c
- ntpd/refclock_spectracom.c
- ntpd/refclock_truetime.c
- ntpd/refclock_zyfer.c
- tests/libntp/strtolfp.c


Changes:

=====================================
libntp/authreadkeys.c
=====================================
--- a/libntp/authreadkeys.c
+++ b/libntp/authreadkeys.c
@@ -24,7 +24,7 @@ nexttok(
 	char	**str
 	)
 {
-	register char *cp;
+	char *cp;
 	char *starttok;
 
 	cp = *str;


=====================================
libntp/hextolfp.c
=====================================
--- a/libntp/hextolfp.c
+++ b/libntp/hextolfp.c
@@ -15,10 +15,10 @@ hextolfp(
 	l_fp *lfp
 	)
 {
-	register const char *cp;
-	register const char *cpstart;
-	register unsigned long dec_i;
-	register unsigned long dec_f;
+	const char *cp;
+	const char *cpstart;
+	unsigned long dec_i;
+	unsigned long dec_f;
 	char *ind = NULL;
 	static const char *digits = "0123456789abcdefABCDEF";
 


=====================================
libntp/numtoa.c
=====================================
--- a/libntp/numtoa.c
+++ b/libntp/numtoa.c
@@ -17,8 +17,8 @@ numtoa(
 	uint32_t num
 	)
 {
-	register uint32_t netnum;
-	register char *buf;
+	uint32_t netnum;
+	char *buf;
 
 	netnum = ntohl(num);
 	buf = lib_getbuf();


=====================================
libntp/recvbuff.c
=====================================
--- a/libntp/recvbuff.c
+++ b/libntp/recvbuff.c
@@ -60,7 +60,7 @@ initialise_buffer(recvbuf_t *buff)
 static void
 create_buffers(unsigned int nbufs)
 {
-	register recvbuf_t *bufp;
+	recvbuf_t *bufp;
 	unsigned int i, abuf;
 
 	abuf = nbufs + buffer_shortfall;


=====================================
libparse/clk_rcc8000.c
=====================================
--- a/libparse/clk_rcc8000.c
+++ b/libparse/clk_rcc8000.c
@@ -106,7 +106,7 @@ cvt_rcc8000(
 
 	if ( (RCCP >= '0' && RCCP <= '9') || (RCCP >= 'A' && RCCP <= 'F') )
 	{
-		register int flag;
+		int flag;
 
 		flag = (RCCP >= '0' && RCCP <= '9' ) ?  RCCP - '0' : RCCP - 'A' + 10;
 


=====================================
libparse/clk_trimtsip.c
=====================================
--- a/libparse/clk_trimtsip.c
+++ b/libparse/clk_trimtsip.c
@@ -179,9 +179,9 @@ cvt_trimtsip(
 	     void          *local
 	     )
 {
-        register struct trimble *t = (struct trimble *)local; /* get local data space */
+        struct trimble *t = (struct trimble *)local; /* get local data space */
 #define mb(_X_) (buffer[2+(_X_)]) /* shortcut for buffer access */
-	register uint8_t cmd;
+	uint8_t cmd;
 
 	UNUSED_ARG(format);
 


=====================================
libparse/parse.c
=====================================
--- a/libparse/parse.c
+++ b/libparse/parse.c
@@ -57,7 +57,7 @@ parse_timedout(
 /*ARGSUSED*/
 bool
 parse_ioinit(
-	register parse_t *parseio
+	parse_t *parseio
 	)
 {
 	parseprintf(DD_PARSE, ("parse_iostart\n"));
@@ -80,7 +80,7 @@ parse_ioinit(
 /*ARGSUSED*/
 void
 parse_ioend(
-	register parse_t *parseio
+	parse_t *parseio
 	)
 {
 	parseprintf(DD_PARSE, ("parse_ioend\n"));
@@ -168,12 +168,12 @@ parse_end(
 /*ARGSUSED*/
 int
 parse_ioread(
-	register parse_t *parseio,
-	register char ch,
-	register timestamp_t *tstamp
+	parse_t *parseio,
+	char ch,
+	timestamp_t *tstamp
 	)
 {
-	register unsigned int updated = CVT_NONE;
+	unsigned int updated = CVT_NONE;
 	/*
 	 * within STREAMS CSx (x < 8) chars still have the upper bits set
 	 * so we normalize the characters by masking unnecessary bits off.
@@ -262,7 +262,7 @@ parse_ioread(
 /*ARGSUSED*/
 void
 parse_iodone(
-	register parse_t *parseio
+	parse_t *parseio
 	)
 {
 	/*
@@ -280,8 +280,8 @@ parse_iodone(
 
 time_t
 parse_to_unixtime(
-	register clocktime_t   *clock_time,
-	register unsigned long *cvtrtc
+	clocktime_t   *clock_time,
+	unsigned long *cvtrtc
 	)
 {
 #define SETRTC(_X_)	{ if (cvtrtc) *cvtrtc = (_X_); }
@@ -289,7 +289,7 @@ parse_to_unixtime(
 	{
 		0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
 	};
-	register int i;
+	int i;
 	time_t t;
 
 	if (clock_time->utctime)
@@ -441,8 +441,8 @@ Strok(
 
 unsigned long
 updatetimeinfo(
-	       register parse_t *parseio,
-	       register unsigned long   flags
+	       parse_t *parseio,
+	       unsigned long   flags
 	       )
 {
 		parseio->parse_lstate          = parseio->parse_dtime.parse_state | flags | PARSEB_TIMECODE;
@@ -464,9 +464,9 @@ updatetimeinfo(
 /*ARGSUSED*/
 static unsigned long
 pps_simple(
-	register parse_t *parseio,
-	register int status,
-	register timestamp_t *ptime
+	parse_t *parseio,
+	int status,
+	timestamp_t *ptime
 	)
 {
 	UNUSED_ARG(status);
@@ -484,9 +484,9 @@ pps_simple(
 /*ARGSUSED*/
 unsigned long
 pps_one(
-	register parse_t *parseio,
-	register int status,
-	register timestamp_t *ptime
+	parse_t *parseio,
+	int status,
+	timestamp_t *ptime
 	)
 {
 	if (status)
@@ -502,11 +502,11 @@ pps_one(
  */
 static unsigned long
 timepacket(
-	register parse_t *parseio
+	parse_t *parseio
 	)
 {
-	register unsigned short format;
-	register time_t t;
+	unsigned short format;
+	time_t t;
 	unsigned long cvtrtc;		/* current conversion result */
 	clocktime_t clock_time;
 
@@ -601,7 +601,7 @@ parse_setfmt(
 	{
 		if (dct->parseformat.parse_count)
 		{
-			register unsigned short i;
+			unsigned short i;
 
 			for (i = 0; i < nformats; i++)
 			{


=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -887,7 +887,7 @@ process_control(
  */
 unsigned short
 ctlpeerstatus(
-	register struct peer *p
+	struct peer *p
 	)
 {
 	unsigned short status;
@@ -928,7 +928,7 @@ ctlclkstatus(
 static unsigned short
 ctlsysstatus(void)
 {
-	register uint8_t this_clock;
+	uint8_t this_clock;
 
 	this_clock = CTL_SST_TS_UNSPEC;
 #ifdef REFCLOCK
@@ -1189,8 +1189,8 @@ ctl_putuint(
 	unsigned long uval
 	)
 {
-	register char *cp;
-	register const char *cq;
+	char *cp;
+	const char *cq;
 	char buffer[200];
 
 	cp = buffer;
@@ -1214,8 +1214,8 @@ ctl_puttime(
 	time_t uval
 	)
 {
-	register char *cp;
-	register const char *cq;
+	char *cp;
+	const char *cq;
 	char buffer[200];
 	struct tm tmbuf, *tm = NULL;
 	time_t fstamp = uval;
@@ -1248,8 +1248,8 @@ ctl_puthex(
 	unsigned long uval
 	)
 {
-	register char *cp;
-	register const char *cq;
+	char *cp;
+	const char *cq;
 	char buffer[200];
 
 	cp = buffer;
@@ -1274,8 +1274,8 @@ ctl_putint(
 	long ival
 	)
 {
-	register char *cp;
-	register const char *cq;
+	char *cp;
+	const char *cq;
 	char buffer[200];
 
 	cp = buffer;
@@ -1300,8 +1300,8 @@ ctl_putts(
 	l_fp *ts
 	)
 {
-	register char *cp;
-	register const char *cq;
+	char *cp;
+	const char *cq;
 	char buffer[200];
 
 	cp = buffer;
@@ -1328,8 +1328,8 @@ ctl_putadr(
 	sockaddr_u *addr
 	)
 {
-	register char *cp;
-	register const char *cq;
+	char *cp;
+	const char *cq;
 	char buffer[200];
 
 	cp = buffer;
@@ -1399,8 +1399,8 @@ ctl_putarray(
 	int start
 	)
 {
-	register char *cp;
-	register const char *cq;
+	char *cp;
+	const char *cq;
 	char buffer[200];
 	int i;
 	cp = buffer;


=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -2280,7 +2280,7 @@ read_network_packet(
 {
 	socklen_t fromlen;
 	ssize_t buflen;
-	register struct recvbuf *rb;
+	struct recvbuf *rb;
 	struct msghdr msghdr;
 	struct iovec iovec;
 	char control[100];   /* FIXME: Need space for time stamp plus overhead */


=====================================
ntpd/refclock_arbiter.c
=====================================
--- a/ntpd/refclock_arbiter.c
+++ b/ntpd/refclock_arbiter.c
@@ -142,7 +142,7 @@ arb_start(
 	struct peer *peer
 	)
 {
-	register struct arbunit *up;
+	struct arbunit *up;
 	struct refclockproc *pp;
 	int fd;
 	char device[20];
@@ -204,7 +204,7 @@ arb_shutdown(
 	struct peer *peer
 	)
 {
-	register struct arbunit *up;
+	struct arbunit *up;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);
@@ -226,7 +226,7 @@ arb_receive(
 	struct recvbuf *rbufp
 	)
 {
-	register struct arbunit *up;
+	struct arbunit *up;
 	struct refclockproc *pp;
 	struct peer *peer;
 	l_fp trtmp;
@@ -428,7 +428,7 @@ arb_poll(
 	struct peer *peer
 	)
 {
-	register struct arbunit *up;
+	struct arbunit *up;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);


=====================================
ntpd/refclock_hpgps.c
=====================================
--- a/ntpd/refclock_hpgps.c
+++ b/ntpd/refclock_hpgps.c
@@ -149,7 +149,7 @@ hpgps_start(
 	struct peer *peer
 	)
 {
-	register struct hpgpsunit *up;
+	struct hpgpsunit *up;
 	struct refclockproc *pp;
 	int fd;
 	unsigned int ldisc;
@@ -226,7 +226,7 @@ hpgps_shutdown(
 	struct peer *peer
 	)
 {
-	register struct hpgpsunit *up;
+	struct hpgpsunit *up;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);
@@ -248,7 +248,7 @@ hpgps_receive(
 	struct recvbuf *rbufp
 	)
 {
-	register struct hpgpsunit *up;
+	struct hpgpsunit *up;
 	struct refclockproc *pp;
 	struct peer *peer;
 	l_fp trtmp;
@@ -574,7 +574,7 @@ hpgps_poll(
 	struct peer *peer
 	)
 {
-	register struct hpgpsunit *up;
+	struct hpgpsunit *up;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);


=====================================
ntpd/refclock_magnavox.c
=====================================
--- a/ntpd/refclock_magnavox.c
+++ b/ntpd/refclock_magnavox.c
@@ -173,7 +173,7 @@ mx4200_start(
 	struct peer *peer
 	)
 {
-	register struct mx4200unit *up;
+	struct mx4200unit *up;
 	struct refclockproc *pp;
 	int fd;
 	char gpsdev[20];
@@ -233,7 +233,7 @@ mx4200_shutdown(
 	struct peer *peer
 	)
 {
-	register struct mx4200unit *up;
+	struct mx4200unit *up;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);
@@ -257,7 +257,7 @@ mx4200_config(
 {
 	char tr_mode;
 	int add_mode;
-	register struct mx4200unit *up;
+	struct mx4200unit *up;
 	struct refclockproc *pp;
 	int mode;
 
@@ -455,7 +455,7 @@ mx4200_ref(
 	struct peer *peer
 	)
 {
-	register struct mx4200unit *up;
+	struct mx4200unit *up;
 	struct refclockproc *pp;
 	double minute, lat, lon, alt;
 	char lats[16], lons[16];
@@ -576,7 +576,7 @@ mx4200_poll(
 	struct peer *peer
 	)
 {
-	register struct mx4200unit *up;
+	struct mx4200unit *up;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);
@@ -639,7 +639,7 @@ mx4200_receive(
 	struct recvbuf *rbufp
 	)
 {
-	register struct mx4200unit *up;
+	struct mx4200unit *up;
 	struct refclockproc *pp;
 	struct peer *peer;
 	char *cp;
@@ -1092,11 +1092,11 @@ mx4200_parse_t(
  */
 static uint8_t
 mx4200_cksum(
-	register char *cp,
-	register int n
+	char *cp,
+	int n
 	)
 {
-	register uint8_t ck;
+	uint8_t ck;
 
 	for (ck = 0; n-- > 0; cp++)
 		ck ^= *cp;
@@ -1119,7 +1119,7 @@ mx4200_jday(
 	int day_of_month
 	)
 {
-	register int day, i;
+	int day, i;
 	bool leap_year;
 
 	/*
@@ -1562,7 +1562,7 @@ mx4200_send(struct peer *peer, const char *fmt, ...)
 {
 	struct refclockproc *pp;
 
-	register int n, m;
+	int n, m;
 	va_list ap;
 	char buf1[1024];
 	char buf[sizeof(buf1)  + 10];


=====================================
ntpd/refclock_oncore.c
=====================================
--- a/ntpd/refclock_oncore.c
+++ b/ntpd/refclock_oncore.c
@@ -585,7 +585,7 @@ oncore_start(
 	)
 {
 #define STRING_LEN	32
-	register struct instance *instance;
+	struct instance *instance;
 	struct refclockproc *pp;
 	int fd1, fd2;
 	char device1[STRING_LEN], device2[STRING_LEN];
@@ -768,7 +768,7 @@ oncore_shutdown(
 	struct peer *peer
 	)
 {
-	register struct instance *instance;
+	struct instance *instance;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);


=====================================
ntpd/refclock_spectracom.c
=====================================
--- a/ntpd/refclock_spectracom.c
+++ b/ntpd/refclock_spectracom.c
@@ -167,7 +167,7 @@ spectracom_start(
 	struct peer *peer
 	)
 {
-	register struct spectracomunit *up;
+	struct spectracomunit *up;
 	struct refclockproc *pp;
 	int fd;
 	char device[20];
@@ -446,7 +446,7 @@ spectracom_timer(
 {
 	UNUSED_ARG(unit);
 
-	register struct spectracomunit *up;
+	struct spectracomunit *up;
 	struct refclockproc *pp;
 	char	pollchar;	/* character sent to clock */
 #ifdef DEBUG
@@ -493,7 +493,7 @@ spectracom_poll(
 	struct peer *peer
 	)
 {
-	register struct spectracomunit *up;
+	struct spectracomunit *up;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);
@@ -555,7 +555,7 @@ spectracom_control(
 	struct peer *peer
 	)
 {
-	register struct spectracomunit *up;
+	struct spectracomunit *up;
 	struct refclockproc *pp;
 	
 	UNUSED_ARG(unit);


=====================================
ntpd/refclock_truetime.c
=====================================
--- a/ntpd/refclock_truetime.c
+++ b/ntpd/refclock_truetime.c
@@ -224,7 +224,7 @@ true_start(
 	struct peer *peer
 	)
 {
-	register struct true_unit *up;
+	struct true_unit *up;
 	struct refclockproc *pp;
 	char device[40];
 	int fd;
@@ -290,7 +290,7 @@ true_shutdown(
 	struct peer *peer
 	)
 {
-	register struct true_unit *up;
+	struct true_unit *up;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);
@@ -312,7 +312,7 @@ true_receive(
 	struct recvbuf *rbufp
 	)
 {
-	register struct true_unit *up;
+	struct true_unit *up;
 	struct refclockproc *pp;
 	struct peer *peer;
 	unsigned short new_station;


=====================================
ntpd/refclock_zyfer.c
=====================================
--- a/ntpd/refclock_zyfer.c
+++ b/ntpd/refclock_zyfer.c
@@ -116,7 +116,7 @@ zyfer_start(
 	struct peer *peer
 	)
 {
-	register struct zyferunit *up;
+	struct zyferunit *up;
 	struct refclockproc *pp;
 	int fd;
 	char device[20];
@@ -176,7 +176,7 @@ zyfer_shutdown(
 	struct peer *peer
 	)
 {
-	register struct zyferunit *up;
+	struct zyferunit *up;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);
@@ -198,7 +198,7 @@ zyfer_receive(
 	struct recvbuf *rbufp
 	)
 {
-	register struct zyferunit *up;
+	struct zyferunit *up;
 	struct refclockproc *pp;
 	struct peer *peer;
 	int tmode;		/* Time mode */
@@ -304,7 +304,7 @@ zyfer_poll(
 	struct peer *peer
 	)
 {
-	register struct zyferunit *up;
+	struct zyferunit *up;
 	struct refclockproc *pp;
 
 	UNUSED_ARG(unit);


=====================================
tests/libntp/strtolfp.c
=====================================
--- a/tests/libntp/strtolfp.c
+++ b/tests/libntp/strtolfp.c
@@ -38,9 +38,9 @@ atolfp(
 	l_fp *lfp
 	)
 {
-	register const char *cp;
-	register unsigned long dec_i;
-	register unsigned long dec_f;
+	const char *cp;
+	unsigned long dec_i;
+	unsigned long dec_f;
 	char *ind;
 	int ndec;
 	bool isneg;
@@ -98,9 +98,9 @@ atolfp(
 	}
 
 	if (ndec > 0) {
-		register unsigned long tmp;
-		register unsigned long bit;
-		register unsigned long ten_fact;
+		unsigned long tmp;
+		unsigned long bit;
+		unsigned long ten_fact;
 
 		ten_fact = ten_to_the_n[ndec];
 
@@ -138,9 +138,9 @@ mstolfp(
 	l_fp *lfp
 	)
 {
-	register const char *cp;
-	register char *bp;
-	register const char *cpdec;
+	const char *cp;
+	char *bp;
+	const char *cpdec;
 	char buf[100];
 
 	/*
@@ -194,7 +194,7 @@ mstolfp(
 	 */
 	*bp++ = '.';
 	if ((cpdec - cp) < 3) {
-		register int i = 3 - (cpdec - cp);
+		int i = 3 - (cpdec - cp);
 
 		do {
 			*bp++ = '0';



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f0bf5b0ef6a4953a0f994031e654c4a91760f5f0

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f0bf5b0ef6a4953a0f994031e654c4a91760f5f0
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/20170915/0e014fbc/attachment.html>


More information about the vc mailing list