Merge pull request #9594 from donaldsharp/strict_prototypes

Strict prototypes
This commit is contained in:
Russ White 2021-09-10 14:23:49 -04:00 committed by GitHub
commit 5bdc0346dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 17 deletions

View File

@ -283,13 +283,6 @@ SNMP_LOCAL_VARIABLES
* *
* 2. I could be replaced in unit test environment * 2. I could be replaced in unit test environment
*/ */
#ifndef ISIS_SNMP_HAVE_TIME_FUNC
static uint32_t isis_snmp_time(void)
{
return (uint32_t)time(NULL);
}
#endif
/* ISIS-MIB instances. */ /* ISIS-MIB instances. */
static oid isis_oid[] = {ISIS_MIB}; static oid isis_oid[] = {ISIS_MIB};
@ -2083,7 +2076,7 @@ static uint8_t *isis_snmp_find_circ(struct variable *v, oid *name,
struct isis_circuit *circuit; struct isis_circuit *circuit;
uint32_t up_ticks; uint32_t up_ticks;
uint32_t delta_ticks; uint32_t delta_ticks;
uint32_t now_time; time_t now_time;
int res; int res;
*write_method = NULL; *write_method = NULL;
@ -2191,7 +2184,7 @@ static uint8_t *isis_snmp_find_circ(struct variable *v, oid *name,
return SNMP_INTEGER(0); return SNMP_INTEGER(0);
up_ticks = (uint32_t)netsnmp_get_agent_uptime(); up_ticks = (uint32_t)netsnmp_get_agent_uptime();
now_time = isis_snmp_time(); now_time = time(NULL);
if (circuit->last_uptime >= now_time) if (circuit->last_uptime >= now_time)
return SNMP_INTEGER(up_ticks); return SNMP_INTEGER(up_ticks);
@ -2501,11 +2494,11 @@ static uint8_t *isis_snmp_find_isadj(struct variable *v, oid *name,
oid *oid_idx; oid *oid_idx;
size_t oid_idx_len; size_t oid_idx_len;
int res; int res;
uint32_t val; time_t val;
struct isis_adjacency *adj; struct isis_adjacency *adj;
uint32_t up_ticks; uint32_t up_ticks;
uint32_t delta_ticks; uint32_t delta_ticks;
uint32_t now_time; time_t now_time;
*write_method = NULL; *write_method = NULL;
@ -2577,7 +2570,7 @@ static uint8_t *isis_snmp_find_isadj(struct variable *v, oid *name,
* It seems that we want remaining timer * It seems that we want remaining timer
*/ */
if (adj->last_upd != 0) { if (adj->last_upd != 0) {
val = isis_snmp_time(); val = time(NULL);
if (val < (adj->last_upd + adj->hold_time)) if (val < (adj->last_upd + adj->hold_time))
return SNMP_INTEGER(adj->last_upd return SNMP_INTEGER(adj->last_upd
+ adj->hold_time - val); + adj->hold_time - val);
@ -2594,7 +2587,7 @@ static uint8_t *isis_snmp_find_isadj(struct variable *v, oid *name,
up_ticks = (uint32_t)netsnmp_get_agent_uptime(); up_ticks = (uint32_t)netsnmp_get_agent_uptime();
now_time = isis_snmp_time(); now_time = time(NULL);
if (adj->last_flap >= now_time) if (adj->last_flap >= now_time)
return SNMP_INTEGER(up_ticks); return SNMP_INTEGER(up_ticks);
@ -2853,7 +2846,7 @@ static int isis_snmp_trap_throttle(oid trap_id)
if (isis == NULL || !isis->snmp_notifications || !smux_enabled()) if (isis == NULL || !isis->snmp_notifications || !smux_enabled())
return 0; return 0;
time_now = isis_snmp_time(); time_now = time(NULL);
if ((isis_snmp_trap_timestamp[trap_id] + 5) > time_now) if ((isis_snmp_trap_timestamp[trap_id] + 5) > time_now)
/* Throttle trap rate at 1 in 5 secs */ /* Throttle trap rate at 1 in 5 secs */

View File

@ -352,7 +352,16 @@ static int segment_list_has_src_dst(
nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY,
"ipv6_adjacency"); "ipv6_adjacency");
node_src_id = adj_src_ipv6_str; node_src_id = adj_src_ipv6_str;
} else {
/*
* This is just to make the compiler happy about
* node_src_id not being initialized. This
* should never happen unless we change the cli
* function.
*/
assert(!"We must have a adj_src_ipv4_str or a adj_src_ipv6_str");
} }
/* addresses */ /* addresses */
snprintf(xpath, XPATH_MAXLEN, "./segment[index='%s']/nai/local-address", snprintf(xpath, XPATH_MAXLEN, "./segment[index='%s']/nai/local-address",
index_str); index_str);

View File

@ -77,7 +77,7 @@ static int lm_release_chunk_pi(struct zserv *client, uint32_t start,
/* use external allocations */ /* use external allocations */
static void lp_plugin_init() static void lp_plugin_init(void)
{ {
/* register our own hooks */ /* register our own hooks */
hook_register(lm_client_connect, test_client_connect); hook_register(lm_client_connect, test_client_connect);
@ -86,7 +86,7 @@ static void lp_plugin_init()
hook_register(lm_release_chunk, lm_release_chunk_pi); hook_register(lm_release_chunk, lm_release_chunk_pi);
} }
static void lp_plugin_cleanup() static void lp_plugin_cleanup(void)
{ {
/* register our own hooks */ /* register our own hooks */
hook_unregister(lm_client_connect, test_client_connect); hook_unregister(lm_client_connect, test_client_connect);
@ -98,7 +98,7 @@ static void lp_plugin_cleanup()
/* tests */ /* tests */
static void test_lp_plugin() static void test_lp_plugin(void)
{ {
struct label_manager_chunk *lmc; struct label_manager_chunk *lmc;