[Git][NTPsec/ntpsec][master] remove #define of NULL
Gary E. Miller
gitlab at mg.gitlab.com
Wed Feb 8 22:08:16 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
22c0202f by Gary E. Miller at 2017-02-08T14:07:18-08:00
remove #define of NULL
Why obfuscate a basic C idiom?
- - - - -
20 changed files:
- include/ntp_refclock.h
- ntpd/ntp_refclock.c
- ntpd/refclock_arbiter.c
- ntpd/refclock_conf.c
- ntpd/refclock_generic.c
- ntpd/refclock_hpgps.c
- ntpd/refclock_jjy.c
- ntpd/refclock_jupiter.c
- ntpd/refclock_local.c
- ntpd/refclock_magnavox.c
- ntpd/refclock_modem.c
- ntpd/refclock_neoclock.c
- ntpd/refclock_nmea.c
- ntpd/refclock_oncore.c
- ntpd/refclock_pps.c
- ntpd/refclock_shm.c
- ntpd/refclock_spectracom.c
- ntpd/refclock_trimble.c
- ntpd/refclock_truetime.c
- ntpd/refclock_zyfer.c
Changes:
=====================================
include/ntp_refclock.h
=====================================
--- a/include/ntp_refclock.h
+++ b/include/ntp_refclock.h
@@ -155,7 +155,6 @@ struct refclockproc {
* ntp_refclock.c and particular clock drivers. This must agree with the
* structure defined in the driver.
*/
-#define noentry NULL /* flag for null routine */
struct refclock {
const char *basename;
=====================================
ntpd/ntp_refclock.c
=====================================
--- a/ntpd/ntp_refclock.c
+++ b/ntpd/ntp_refclock.c
@@ -148,7 +148,7 @@ init_refclock(void)
int i;
for (i = 0; i < (int)num_refclock_conf; i++)
- if (refclock_conf[i]->clock_init != noentry)
+ if (refclock_conf[i]->clock_init)
(refclock_conf[i]->clock_init)();
}
@@ -174,7 +174,7 @@ refclock_newpeer(
struct refclockproc *pp;
if (clktype >= num_refclock_conf ||
- refclock_conf[clktype]->clock_start == noentry) {
+ refclock_conf[!clktype]->clock_start) {
msyslog(LOG_ERR,
"refclock_newpeer: clock type %d invalid\n",
clktype);
@@ -243,7 +243,7 @@ refclock_unpeer(
return;
unit = peer->refclkunit;
- if (peer->procptr->conf->clock_shutdown != noentry)
+ if (peer->procptr->conf->clock_shutdown)
(peer->procptr->conf->clock_shutdown)(unit, peer);
free(peer->procptr);
peer->procptr = NULL;
@@ -263,7 +263,7 @@ refclock_timer(
unit = p->refclkunit;
pp = p->procptr;
- if (pp->conf->clock_timer != noentry)
+ if (pp->conf->clock_timer)
(*pp->conf->clock_timer)(unit, p);
if (pp->action != NULL && pp->nextaction <= current_time)
(*pp->action)(p);
@@ -323,7 +323,7 @@ refclock_transmit(
} else {
peer->burst--;
}
- if (peer->procptr->conf->clock_poll != noentry)
+ if (peer->procptr->conf->clock_poll)
(peer->procptr->conf->clock_poll)(unit, peer);
poll_update(peer, peer->hpoll);
}
@@ -948,7 +948,7 @@ refclock_control(
/*
* Give the stuff to the clock
*/
- if (peer->procptr->conf->clock_control != noentry)
+ if (peer->procptr->conf->clock_control)
(peer->procptr->conf->clock_control)(unit, in, out, peer);
}
=====================================
ntpd/refclock_arbiter.c
=====================================
--- a/ntpd/refclock_arbiter.c
+++ b/ntpd/refclock_arbiter.c
@@ -123,9 +123,9 @@ struct refclock refclock_arbiter = {
arb_start, /* start up driver */
arb_shutdown, /* shut down driver */
arb_poll, /* transmit poll message */
- noentry, /* not used (old arb_control) */
- noentry, /* initialize driver (not used) */
- noentry /* timer - not used */
+ NULL, /* not used (old arb_control) */
+ NULL, /* initialize driver (not used) */
+ NULL /* timer - not used */
};
=====================================
ntpd/refclock_conf.c
=====================================
--- a/ntpd/refclock_conf.c
+++ b/ntpd/refclock_conf.c
@@ -14,7 +14,13 @@
#include "ntp_stdlib.h"
static struct refclock refclock_none = {
- NULL, noentry, noentry, noentry, noentry, noentry, noentry
+ NULL, /* basename of driver */
+ NULL, /* start up driver */
+ NULL, /* shut down driver */
+ NULL, /* transmit poll message */
+ NULL, /* not used (old hpgps_control) */
+ NULL, /* initialize driver */
+ NULL, /* timer - not used */
};
#ifdef CLOCK_LOCAL
=====================================
ntpd/refclock_generic.c
=====================================
--- a/ntpd/refclock_generic.c
+++ b/ntpd/refclock_generic.c
@@ -134,12 +134,12 @@ static void parse_control (int, const struct refclockstat *, struct refclockstat
struct refclock refclock_parse = {
"GENERIC", /* basename of driver */
- parse_start,
- parse_shutdown,
- parse_poll,
- parse_control,
- noentry,
- noentry
+ parse_start, /* start up driver */
+ parse_shutdown, /* shut down driver */
+ parse_poll, /* transmit poll message */
+ parse_control, /* control settings */
+ NULL, /* init */
+ NULL, /* timer */
};
/*
=====================================
ntpd/refclock_hpgps.c
=====================================
--- a/ntpd/refclock_hpgps.c
+++ b/ntpd/refclock_hpgps.c
@@ -133,9 +133,9 @@ struct refclock refclock_hpgps = {
hpgps_start, /* start up driver */
hpgps_shutdown, /* shut down driver */
hpgps_poll, /* transmit poll message */
- noentry, /* not used (old hpgps_control) */
- noentry, /* initialize driver */
- noentry /* timer - not used */
+ NULL, /* not used (old hpgps_control) */
+ NULL, /* initialize driver */
+ NULL /* timer - not used */
};
=====================================
ntpd/refclock_jjy.c
=====================================
--- a/ntpd/refclock_jjy.c
+++ b/ntpd/refclock_jjy.c
@@ -324,8 +324,8 @@ struct refclock refclock_jjy = {
jjy_start, /* start up driver */
jjy_shutdown, /* shutdown driver */
jjy_poll, /* transmit poll message */
- noentry, /* control - not used */
- noentry, /* init - not used */
+ NULL, /* control - not used */
+ NULL, /* init - not used */
jjy_timer /* 1 second interval timer */
};
=====================================
ntpd/refclock_jupiter.c
=====================================
--- a/ntpd/refclock_jupiter.c
+++ b/ntpd/refclock_jupiter.c
@@ -380,8 +380,8 @@ struct refclock refclock_jupiter = {
jupiter_shutdown, /* shut down driver */
jupiter_poll, /* transmit poll message */
jupiter_control, /* (clock control) */
- noentry, /* (clock init) */
- noentry /* timer - not used */
+ NULL, /* (clock init) */
+ NULL /* timer - not used */
};
/*
=====================================
ntpd/refclock_local.c
=====================================
--- a/ntpd/refclock_local.c
+++ b/ntpd/refclock_local.c
@@ -84,11 +84,11 @@ static u_long poll_time; /* last time polled */
struct refclock refclock_local = {
NAME, /* basename of driver */
local_start, /* start up driver */
- noentry, /* shut down driver (not used) */
+ NULL, /* shut down driver (not used) */
local_poll, /* transmit poll message */
- noentry, /* not used (old lcl_control) */
- noentry, /* initialize driver (not used) */
- noentry /* timer - not used */
+ NULL, /* not used (old lcl_control) */
+ NULL, /* initialize driver (not used) */
+ NULL /* timer - not used */
};
=====================================
ntpd/refclock_magnavox.c
=====================================
--- a/ntpd/refclock_magnavox.c
+++ b/ntpd/refclock_magnavox.c
@@ -156,9 +156,9 @@ struct refclock refclock_magnavox = {
mx4200_start, /* start up driver */
mx4200_shutdown, /* shut down driver */
mx4200_poll, /* transmit poll message */
- noentry, /* not used (old mx4200_control) */
- noentry, /* initialize driver (not used) */
- noentry /* timer - not used */
+ NULL, /* not used (old mx4200_control) */
+ NULL, /* initialize driver (not used) */
+ NULL /* timer - not used */
};
=====================================
ntpd/refclock_modem.c
=====================================
--- a/ntpd/refclock_modem.c
+++ b/ntpd/refclock_modem.c
@@ -231,8 +231,8 @@ struct refclock refclock_modem = {
modem_start, /* start up driver */
modem_shutdown, /* shut down driver */
modem_poll, /* transmit poll message */
- noentry, /* control - not used */
- noentry, /* init - not used */
+ NULL, /* control - not used */
+ NULL, /* init - not used */
modem_timer /* housekeeping timer */
};
=====================================
ntpd/refclock_neoclock.c
=====================================
--- a/ntpd/refclock_neoclock.c
+++ b/ntpd/refclock_neoclock.c
@@ -115,8 +115,8 @@ struct refclock refclock_neoclock4x = {
neoclock4x_shutdown, /* shut down driver */
neoclock4x_poll, /* transmit poll message */
neoclock4x_control, /* device control */
- noentry, /* initialize driver (not used) */
- noentry, /* tiner - not used */
+ NULL, /* initialize driver (not used) */
+ NULL, /* tiner - not used */
};
static bool
=====================================
ntpd/refclock_nmea.c
=====================================
--- a/ntpd/refclock_nmea.c
+++ b/ntpd/refclock_nmea.c
@@ -289,7 +289,7 @@ static void nmea_control (int, const struct refclockstat *,
struct refclockstat *, struct peer *);
#define NMEA_CONTROL nmea_control
#else
-#define NMEA_CONTROL noentry
+#define NMEA_CONTROL NULL
#endif /* HAVE_PPSAPI */
static void nmea_timer (int, struct peer *);
=====================================
ntpd/refclock_oncore.c
=====================================
--- a/ntpd/refclock_oncore.c
+++ b/ntpd/refclock_oncore.c
@@ -411,9 +411,9 @@ struct refclock refclock_oncore = {
oncore_start, /* start up driver */
oncore_shutdown, /* shut down driver */
oncore_poll, /* transmit poll message */
- noentry, /* control - not used */
- noentry, /* init - not used */
- noentry /* timer - not used */
+ NULL, /* control - not used */
+ NULL, /* init - not used */
+ NULL /* timer - not used */
};
/*
=====================================
ntpd/refclock_pps.c
=====================================
--- a/ntpd/refclock_pps.c
+++ b/ntpd/refclock_pps.c
@@ -104,8 +104,8 @@ struct refclock refclock_pps = {
pps_start, /* start up driver */
pps_shutdown, /* shut down driver */
pps_poll, /* transmit poll message */
- noentry, /* control (not used) */
- noentry, /* initialize driver (not used) */
+ NULL, /* control (not used) */
+ NULL, /* initialize driver (not used) */
pps_timer, /* called once per second */
};
=====================================
ntpd/refclock_shm.c
=====================================
--- a/ntpd/refclock_shm.c
+++ b/ntpd/refclock_shm.c
@@ -74,7 +74,7 @@ struct refclock refclock_shm = {
shm_shutdown, /* shut down driver */
shm_poll, /* transmit poll message */
shm_control, /* control settings */
- noentry, /* not used: init */
+ NULL, /* not used: init */
shm_timer, /* once per second */
};
@@ -159,7 +159,7 @@ shm_start(
struct refclockproc * const pp = peer->procptr;
struct shmunit * const up = emalloc_zero(sizeof(*up));
- pp->io.clock_recv = noentry;
+ pp->io.clock_recv = NULL;
pp->io.srcclock = peer;
pp->io.datalen = 0;
pp->io.fd = -1;
=====================================
ntpd/refclock_spectracom.c
=====================================
--- a/ntpd/refclock_spectracom.c
+++ b/ntpd/refclock_spectracom.c
@@ -136,7 +136,7 @@ static void spectracom_control (int, const struct refclockstat *,
struct refclockstat *, struct peer *);
#define SPECTRACOM_CONTROL spectracom_control
#else
-#define SPECTRACOM_CONTROL noentry
+#define SPECTRACOM_CONTROL NULL
#endif /* HAVE_PPSAPI */
/*
@@ -148,7 +148,7 @@ struct refclock refclock_spectracom = {
spectracom_shutdown, /* shut down driver */
spectracom_poll, /* transmit poll message */
SPECTRACOM_CONTROL, /* fudge set/change notification */
- noentry, /* initialize driver (not used) */
+ NULL, /* initialize driver (not used) */
spectracom_timer /* called once per second */
};
=====================================
ntpd/refclock_trimble.c
=====================================
--- a/ntpd/refclock_trimble.c
+++ b/ntpd/refclock_trimble.c
@@ -204,9 +204,9 @@ struct refclock refclock_trimble = {
trimble_start, /* start up driver */
trimble_shutdown, /* shut down driver */
trimble_poll, /* transmit poll message */
- noentry, /* control - not used */
- noentry, /* initialize driver (not used) */
- noentry /* timer - not used */
+ NULL, /* control - not used */
+ NULL, /* initialize driver (not used) */
+ NULL /* timer - not used */
};
int day_of_year (char *dt);
=====================================
ntpd/refclock_truetime.c
=====================================
--- a/ntpd/refclock_truetime.c
+++ b/ntpd/refclock_truetime.c
@@ -163,9 +163,9 @@ struct refclock refclock_true = {
true_start, /* start up driver */
true_shutdown, /* shut down driver */
true_poll, /* transmit poll message */
- noentry, /* not used (old true_control) */
- noentry, /* initialize driver (not used) */
- noentry /* timer - not used */
+ NULL, /* not used (old true_control) */
+ NULL, /* initialize driver (not used) */
+ NULL /* timer - not used */
};
=====================================
ntpd/refclock_zyfer.c
=====================================
--- a/ntpd/refclock_zyfer.c
+++ b/ntpd/refclock_zyfer.c
@@ -101,9 +101,9 @@ struct refclock refclock_zyfer = {
zyfer_start, /* start up driver */
zyfer_shutdown, /* shut down driver */
zyfer_poll, /* transmit poll message */
- noentry, /* not used (old zyfer_control) */
- noentry, /* initialize driver (not used) */
- noentry /* timer - not used */
+ NULL, /* not used (old zyfer_control) */
+ NULL, /* initialize driver (not used) */
+ NULL /* timer - not used */
};
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/22c0202fcc90096784e80d2c4fa2756c469822c8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170208/a7bd980a/attachment.html>
More information about the vc
mailing list