diff --git a/bfdd/control.c b/bfdd/control.c index 4929bf1998..e772aadfc4 100644 --- a/bfdd/control.c +++ b/bfdd/control.c @@ -167,7 +167,6 @@ int control_accept(struct thread *t) control_new(csock); - bglobal.bg_csockev = NULL; thread_add_read(master, control_accept, NULL, sd, &bglobal.bg_csockev); return 0; diff --git a/isisd/fabricd.c b/isisd/fabricd.c index 20651706d3..0f10a1516a 100644 --- a/isisd/fabricd.c +++ b/isisd/fabricd.c @@ -413,7 +413,6 @@ static int fabricd_tier_calculation_cb(struct thread *thread) { struct fabricd *f = THREAD_ARG(thread); uint8_t tier = ISIS_TIER_UNDEFINED; - f->tier_calculation_timer = NULL; tier = fabricd_calculate_fabric_tier(f->area); if (tier == ISIS_TIER_UNDEFINED) diff --git a/isisd/isis_tx_queue.c b/isisd/isis_tx_queue.c index c7266152b7..d3da5b9d39 100644 --- a/isisd/isis_tx_queue.c +++ b/isisd/isis_tx_queue.c @@ -119,7 +119,6 @@ static int tx_queue_send_event(struct thread *thread) struct isis_tx_queue_entry *e = THREAD_ARG(thread); struct isis_tx_queue *queue = e->queue; - e->retry = NULL; thread_add_timer(master, tx_queue_send_event, e, 5, &e->retry); if (e->is_retry) diff --git a/ldpd/accept.c b/ldpd/accept.c index 9bba0f5ddd..e8d3976ee9 100644 --- a/ldpd/accept.c +++ b/ldpd/accept.c @@ -58,7 +58,6 @@ accept_add(int fd, int (*cb)(struct thread *), void *arg) av->arg = arg; LIST_INSERT_HEAD(&accept_queue.queue, av, entry); - av->ev = NULL; thread_add_read(master, accept_cb, av, av->fd, &av->ev); log_debug("%s: accepting on fd %d", __func__, fd); @@ -86,7 +85,6 @@ accept_pause(void) { log_debug(__func__); accept_unarm(); - accept_queue.evt = NULL; thread_add_timer(master, accept_timeout, NULL, 1, &accept_queue.evt); } @@ -105,7 +103,6 @@ accept_arm(void) { struct accept_ev *av; LIST_FOREACH(av, &accept_queue.queue, entry) { - av->ev = NULL; thread_add_read(master, accept_cb, av, av->fd, &av->ev); } } @@ -122,7 +119,6 @@ static int accept_cb(struct thread *thread) { struct accept_ev *av = THREAD_ARG(thread); - av->ev = NULL; thread_add_read(master, accept_cb, av, av->fd, &av->ev); av->accept_cb(thread); diff --git a/ldpd/interface.c b/ldpd/interface.c index 3e9f2fa991..5e04eab1b3 100644 --- a/ldpd/interface.c +++ b/ldpd/interface.c @@ -471,7 +471,6 @@ static void if_start_hello_timer(struct iface_af *ia) { thread_cancel(&ia->hello_timer); - ia->hello_timer = NULL; thread_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia), &ia->hello_timer); } diff --git a/ldpd/lde.c b/ldpd/lde.c index 2d35d097a1..babadc461f 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -145,7 +145,6 @@ lde(void) fatal(NULL); imsg_init(&iev_main->ibuf, LDPD_FD_ASYNC); iev_main->handler_read = lde_dispatch_parent; - iev_main->ev_read = NULL; thread_add_read(master, iev_main->handler_read, iev_main, iev_main->ibuf.fd, &iev_main->ev_read); iev_main->handler_write = ldp_write_handler; @@ -555,7 +554,6 @@ lde_dispatch_parent(struct thread *thread) fatal(NULL); imsg_init(&iev_ldpe->ibuf, fd); iev_ldpe->handler_read = lde_dispatch_imsg; - iev_ldpe->ev_read = NULL; thread_add_read(master, iev_ldpe->handler_read, iev_ldpe, iev_ldpe->ibuf.fd, &iev_ldpe->ev_read); iev_ldpe->handler_write = ldp_write_handler; diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c index 0f91f49920..33bb6c0fc7 100644 --- a/ldpd/lde_lib.c +++ b/ldpd/lde_lib.c @@ -1072,7 +1072,6 @@ void lde_gc_start_timer(void) { thread_cancel(&gc_timer); - gc_timer = NULL; thread_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL, &gc_timer); } diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index e24eba7cd4..9d80bed77f 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -403,28 +403,24 @@ main(int argc, char *argv[]) fatal(NULL); imsg_init(&iev_ldpe->ibuf, pipe_parent2ldpe[0]); iev_ldpe->handler_read = main_dispatch_ldpe; - iev_ldpe->ev_read = NULL; thread_add_read(master, iev_ldpe->handler_read, iev_ldpe, iev_ldpe->ibuf.fd, &iev_ldpe->ev_read); iev_ldpe->handler_write = ldp_write_handler; imsg_init(&iev_ldpe_sync->ibuf, pipe_parent2ldpe_sync[0]); iev_ldpe_sync->handler_read = main_dispatch_ldpe; - iev_ldpe_sync->ev_read = NULL; thread_add_read(master, iev_ldpe_sync->handler_read, iev_ldpe_sync, iev_ldpe_sync->ibuf.fd, &iev_ldpe_sync->ev_read); iev_ldpe_sync->handler_write = ldp_write_handler; imsg_init(&iev_lde->ibuf, pipe_parent2lde[0]); iev_lde->handler_read = main_dispatch_lde; - iev_lde->ev_read = NULL; thread_add_read(master, iev_lde->handler_read, iev_lde, iev_lde->ibuf.fd, &iev_lde->ev_read); iev_lde->handler_write = ldp_write_handler; imsg_init(&iev_lde_sync->ibuf, pipe_parent2lde_sync[0]); iev_lde_sync->handler_read = main_dispatch_lde; - iev_lde_sync->ev_read = NULL; thread_add_read(master, iev_lde_sync->handler_read, iev_lde_sync, iev_lde_sync->ibuf.fd, &iev_lde_sync->ev_read); iev_lde_sync->handler_write = ldp_write_handler; diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index 428d2ab7b4..fff7ee7c67 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -122,7 +122,6 @@ ldpe(void) fatal(NULL); imsg_init(&iev_main->ibuf, LDPD_FD_ASYNC); iev_main->handler_read = ldpe_dispatch_main; - iev_main->ev_read = NULL; thread_add_read(master, iev_main->handler_read, iev_main, iev_main->ibuf.fd, &iev_main->ev_read); iev_main->handler_write = ldp_write_handler; @@ -149,7 +148,6 @@ ldpe_init(struct ldpd_init *init) /* This socket must be open before dropping privileges. */ global.pfkeysock = pfkey_init(); if (sysdep.no_pfkey == 0) { - pfkey_ev = NULL; thread_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock, &pfkey_ev); } @@ -377,7 +375,6 @@ ldpe_dispatch_main(struct thread *thread) fatal(NULL); imsg_init(&iev_lde->ibuf, fd); iev_lde->handler_read = ldpe_dispatch_lde; - iev_lde->ev_read = NULL; thread_add_read(master, iev_lde->handler_read, iev_lde, iev_lde->ibuf.fd, &iev_lde->ev_read); iev_lde->handler_write = ldp_write_handler; @@ -784,7 +781,6 @@ ldpe_dispatch_pfkey(struct thread *thread) { int fd = THREAD_FD(thread); - pfkey_ev = NULL; thread_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock, &pfkey_ev); @@ -805,13 +801,11 @@ ldpe_setup_sockets(int af, int disc_socket, int edisc_socket, /* discovery socket */ af_global->ldp_disc_socket = disc_socket; - af_global->disc_ev = NULL; thread_add_read(master, disc_recv_packet, &af_global->disc_ev, af_global->ldp_disc_socket, &af_global->disc_ev); /* extended discovery socket */ af_global->ldp_edisc_socket = edisc_socket; - af_global->edisc_ev = NULL; thread_add_read(master, disc_recv_packet, &af_global->edisc_ev, af_global->ldp_edisc_socket, &af_global->edisc_ev); diff --git a/ldpd/packet.c b/ldpd/packet.c index 8735faf3dd..56af16d280 100644 --- a/ldpd/packet.c +++ b/ldpd/packet.c @@ -141,7 +141,6 @@ disc_recv_packet(struct thread *thread) struct in_addr lsr_id; /* reschedule read */ - *threadp = NULL; thread_add_read(master, disc_recv_packet, threadp, fd, threadp); /* setup buffer */ @@ -425,7 +424,6 @@ session_read(struct thread *thread) uint16_t pdu_len, msg_len, msg_size, max_pdu_len; int ret; - tcp->rev = NULL; thread_add_read(master, session_read, nbr, fd, &tcp->rev); if ((n = read(fd, tcp->rbuf->buf + tcp->rbuf->wpos, @@ -745,7 +743,6 @@ tcp_new(int fd, struct nbr *nbr) if ((tcp->rbuf = calloc(1, sizeof(struct ibuf_read))) == NULL) fatal(__func__); - tcp->rev = NULL; thread_add_read(master, session_read, nbr, tcp->fd, &tcp->rev); tcp->nbr = nbr; } diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c index 5fcb311888..0a618056d5 100644 --- a/nhrpd/netlink_arp.c +++ b/nhrpd/netlink_arp.c @@ -107,7 +107,6 @@ static int netlink_log_recv(struct thread *t) struct zbuf payload, zb; struct nlmsghdr *n; - netlink_log_thread = NULL; zbuf_init(&zb, buf, sizeof(buf), 0); while (zbuf_recv(&zb, fd) > 0) { diff --git a/nhrpd/nhrp_event.c b/nhrpd/nhrp_event.c index f784ef22d6..206b2caccf 100644 --- a/nhrpd/nhrp_event.c +++ b/nhrpd/nhrp_event.c @@ -84,7 +84,6 @@ static int evmgr_read(struct thread *t) struct zbuf *ibuf = &evmgr->ibuf; struct zbuf msg; - evmgr->t_read = NULL; if (zbuf_read(ibuf, evmgr->fd, (size_t)-1) < 0) { evmgr_connection_error(evmgr); return 0; @@ -103,7 +102,6 @@ static int evmgr_write(struct thread *t) struct event_manager *evmgr = THREAD_ARG(t); int r; - evmgr->t_write = NULL; r = zbufq_write(&evmgr->obuf, evmgr->fd); if (r > 0) { thread_add_write(master, evmgr_write, evmgr, evmgr->fd, @@ -193,7 +191,6 @@ static int evmgr_reconnect(struct thread *t) struct event_manager *evmgr = THREAD_ARG(t); int fd; - evmgr->t_reconnect = NULL; if (evmgr->fd >= 0 || !nhrp_event_socket_path) return 0; diff --git a/nhrpd/nhrp_multicast.c b/nhrpd/nhrp_multicast.c index b78afda2c4..339b6dfabe 100644 --- a/nhrpd/nhrp_multicast.c +++ b/nhrpd/nhrp_multicast.c @@ -149,7 +149,6 @@ static int netlink_mcast_log_recv(struct thread *t) struct zbuf payload, zb; struct nlmsghdr *n; - netlink_mcast_log_thread = NULL; zbuf_init(&zb, buf, sizeof(buf), 0); while (zbuf_recv(&zb, fd) > 0) { diff --git a/nhrpd/nhrp_nhs.c b/nhrpd/nhrp_nhs.c index 9dfaf073d8..5179f15ebf 100644 --- a/nhrpd/nhrp_nhs.c +++ b/nhrpd/nhrp_nhs.c @@ -112,7 +112,6 @@ static int nhrp_reg_timeout(struct thread *t) struct nhrp_registration *r = THREAD_ARG(t); struct nhrp_cache *c; - r->t_register = NULL; if (r->timeout >= 16 && sockunion_family(&r->proto_addr) != AF_UNSPEC) { nhrp_reqid_free(&nhrp_packet_reqid, &r->reqid); @@ -176,7 +175,6 @@ static int nhrp_reg_send_req(struct thread *t) struct nhrp_extension_header *ext; struct nhrp_cie_header *cie; - r->t_register = NULL; if (!nhrp_peer_check(r->peer, 2)) { debugf(NHRP_DEBUG_COMMON, "NHS: Waiting link for %pSU", &r->peer->vc->remote.nbma); @@ -281,7 +279,6 @@ static void nhrp_nhs_resolve_cb(struct resolver_query *q, const char *errstr, struct nhrp_registration *reg, *regn; int i; - nhs->t_resolve = NULL; if (n < 0) { /* Failed, retry in a moment */ thread_add_timer(master, nhrp_nhs_resolve, nhs, 5, diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index 5a7da703ac..030f4c0ff3 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -265,7 +265,6 @@ static int nhrp_peer_request_timeout(struct thread *t) struct interface *ifp = p->ifp; struct nhrp_interface *nifp = ifp->info; - p->t_fallback = NULL; if (p->online) return 0; diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c index 0905ceb72a..244273cd58 100644 --- a/nhrpd/nhrp_shortcut.c +++ b/nhrpd/nhrp_shortcut.c @@ -39,7 +39,6 @@ static int nhrp_shortcut_do_expire(struct thread *t) { struct nhrp_shortcut *s = THREAD_ARG(t); - s->t_timer = NULL; thread_add_timer(master, nhrp_shortcut_do_purge, s, s->holding_time / 3, &s->t_timer); s->expiring = 1; diff --git a/nhrpd/vici.c b/nhrpd/vici.c index c21e01601c..8fce828663 100644 --- a/nhrpd/vici.c +++ b/nhrpd/vici.c @@ -361,7 +361,6 @@ static int vici_read(struct thread *t) struct zbuf *ibuf = &vici->ibuf; struct zbuf pktbuf; - vici->t_read = NULL; if (zbuf_read(ibuf, vici->fd, (size_t)-1) < 0) { vici_connection_error(vici); return 0; @@ -392,7 +391,6 @@ static int vici_write(struct thread *t) struct vici_conn *vici = THREAD_ARG(t); int r; - vici->t_write = NULL; r = zbufq_write(&vici->obuf, vici->fd); if (r > 0) { thread_add_write(master, vici_write, vici, vici->fd, @@ -509,7 +507,6 @@ static int vici_reconnect(struct thread *t) int fd; char *file_path; - vici->t_reconnect = NULL; if (vici->fd >= 0) return 0; diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index df40c608a1..3a6078ff0a 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1139,7 +1139,6 @@ void ospf6_asbr_distribute_list_update(struct ospf6 *ospf6, if (IS_OSPF6_DEBUG_ASBR) zlog_debug("%s: trigger redistribute reset thread", __func__); - ospf6->t_distribute_update = NULL; thread_add_timer_msec(master, ospf6_asbr_routemap_update_timer, ospf6, OSPF_MIN_LS_INTERVAL, &ospf6->t_distribute_update); diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index 3a242575cd..6ad2a70f08 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -546,7 +546,6 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa, /* reschedule retransmissions to all neighbors */ for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { THREAD_OFF(on->thread_send_lsupdate); - on->thread_send_lsupdate = NULL; thread_add_event(master, ospf6_lsupdate_send_neighbor, on, 0, &on->thread_send_lsupdate); } @@ -1112,7 +1111,6 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, "Newer instance of the self-originated LSA"); zlog_debug("Schedule reorigination"); } - new->refresh = NULL; thread_add_event(master, ospf6_lsa_refresh, new, 0, &new->refresh); } diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index b63a3c02db..a3eb1445f1 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -819,7 +819,6 @@ int interface_up(struct thread *thread) /* Schedule Hello */ if (!CHECK_FLAG(oi->flag, OSPF6_INTERFACE_PASSIVE) && !if_is_loopback_or_vrf(oi->interface)) { - oi->thread_send_hello = NULL; thread_add_event(master, ospf6_hello_send, oi, 0, &oi->thread_send_hello); } diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index ac07704d2c..f406e828e1 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -891,7 +891,6 @@ int ospf6_lsa_refresh(struct thread *thread) new = ospf6_lsa_create(self->header); new->lsdb = old->lsdb; - new->refresh = NULL; thread_add_timer(master, ospf6_lsa_refresh, new, OSPF_LS_REFRESH_TIME, &new->refresh); diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 64de9bae41..56dcbb69cb 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -775,7 +775,6 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh, && !CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT)) thread_add_event(master, exchange_done, on, 0, NULL); else { - on->thread_send_dbdesc = NULL; thread_add_event(master, ospf6_dbdesc_send_newone, on, 0, &on->thread_send_dbdesc); } @@ -856,7 +855,6 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, zlog_debug( "Duplicated dbdesc causes retransmit"); THREAD_OFF(on->thread_send_dbdesc); - on->thread_send_dbdesc = NULL; thread_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc); return; @@ -2399,7 +2397,6 @@ int ospf6_lsreq_send(struct thread *thread) /* set next thread */ if (on->request_list->count != 0) { - on->thread_send_lsreq = NULL; thread_add_timer(master, ospf6_lsreq_send, on, on->ospf6_if->rxmt_interval, &on->thread_send_lsreq); @@ -2585,11 +2582,9 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) ospf6_packet_free(op); if (on->lsupdate_list->count != 0) { - on->thread_send_lsupdate = NULL; thread_add_event(master, ospf6_lsupdate_send_neighbor, on, 0, &on->thread_send_lsupdate); } else if (on->retrans_list->count != 0) { - on->thread_send_lsupdate = NULL; thread_add_timer(master, ospf6_lsupdate_send_neighbor, on, on->ospf6_if->rxmt_interval, &on->thread_send_lsupdate); @@ -2703,7 +2698,6 @@ int ospf6_lsupdate_send_interface(struct thread *thread) ospf6_packet_free(op); if (oi->lsupdate_list->count > 0) { - oi->thread_send_lsupdate = NULL; thread_add_event(master, ospf6_lsupdate_send_interface, oi, 0, &oi->thread_send_lsupdate); } diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 35fbd3991c..6f2795a56d 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -273,7 +273,6 @@ int hello_received(struct thread *thread) /* reset Inactivity Timer */ THREAD_OFF(on->inactivity_timer); - on->inactivity_timer = NULL; thread_add_timer(master, inactivity_timer, on, on->ospf6_if->dead_interval, &on->inactivity_timer); @@ -312,7 +311,6 @@ int twoway_received(struct thread *thread) SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); THREAD_OFF(on->thread_send_dbdesc); - on->thread_send_dbdesc = NULL; thread_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc); @@ -438,7 +436,6 @@ void ospf6_check_nbr_loading(struct ospf6_neighbor *on) else if (on->last_ls_req == NULL) { if (on->thread_send_lsreq != NULL) THREAD_OFF(on->thread_send_lsreq); - on->thread_send_lsreq = NULL; thread_add_event(master, ospf6_lsreq_send, on, 0, &on->thread_send_lsreq); } @@ -620,7 +617,6 @@ int inactivity_timer(struct thread *thread) if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *InactivityTimer*", on->name); - on->inactivity_timer = NULL; on->drouter = on->prev_drouter = 0; on->bdrouter = on->prev_bdrouter = 0; diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 50de7124d2..795c96c838 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -671,7 +671,6 @@ void pim_igmp_general_query_on(struct igmp_sock *igmp) ifaddr_str, query_interval, startup_mode ? "startup" : "non-startup", igmp->fd); } - igmp->t_igmp_query_timer = NULL; thread_add_timer(router->master, pim_igmp_general_query, igmp, query_interval, &igmp->t_igmp_query_timer); } @@ -1052,7 +1051,6 @@ static void igmp_read_on(struct igmp_sock *igmp) zlog_debug("Scheduling READ event on IGMP socket fd=%d", igmp->fd); } - igmp->t_igmp_read = NULL; thread_add_read(router->master, pim_igmp_read, igmp, igmp->fd, &igmp->t_igmp_read); } diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c index 78a8265a1c..5fff9fca0e 100644 --- a/pimd/pim_msdp_socket.c +++ b/pimd/pim_msdp_socket.c @@ -205,7 +205,6 @@ int pim_msdp_sock_listen(struct pim_instance *pim) /* add accept thread */ listener->fd = sock; memcpy(&listener->su, &sin, socklen); - listener->thread = NULL; thread_add_read(pim->msdp.master, pim_msdp_sock_accept, pim, sock, &listener->thread); diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 8c38cf6c4c..3df7dc41ce 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -415,7 +415,6 @@ static void pim_sock_read_on(struct interface *ifp) zlog_debug("Scheduling READ event on PIM socket fd=%d", pim_ifp->pim_sock_fd); } - pim_ifp->t_pim_sock_read = NULL; thread_add_read(router->master, pim_sock_read, ifp, pim_ifp->pim_sock_fd, &pim_ifp->t_pim_sock_read); } diff --git a/tests/lib/test_timer_correctness.c b/tests/lib/test_timer_correctness.c index 416ea39772..0ae9761b11 100644 --- a/tests/lib/test_timer_correctness.c +++ b/tests/lib/test_timer_correctness.c @@ -134,7 +134,6 @@ int main(int argc, char **argv) /* Schedule timers to expire in 0..5 seconds */ interval_msec = prng_rand(prng) % 5000; arg = XMALLOC(MTYPE_TMP, TIMESTR_LEN + 1); - timers[i] = NULL; thread_add_timer_msec(master, timer_func, arg, interval_msec, &timers[i]); ret = snprintf(arg, TIMESTR_LEN + 1, "%lld.%06lld", diff --git a/tests/lib/test_timer_performance.c b/tests/lib/test_timer_performance.c index 45b29b92b1..23c044c7c1 100644 --- a/tests/lib/test_timer_performance.c +++ b/tests/lib/test_timer_performance.c @@ -55,7 +55,6 @@ int main(int argc, char **argv) /* create thread structures so they won't be allocated during the * time measurement */ for (i = 0; i < SCHEDULE_TIMERS; i++) { - timers[i] = NULL; thread_add_timer_msec(master, dummy_func, NULL, 0, &timers[i]); } for (i = 0; i < SCHEDULE_TIMERS; i++) @@ -67,7 +66,6 @@ int main(int argc, char **argv) long interval_msec; interval_msec = prng_rand(prng) % (100 * SCHEDULE_TIMERS); - timers[i] = NULL; thread_add_timer_msec(master, dummy_func, NULL, interval_msec, &timers[i]); } diff --git a/tools/coccinelle/struct_thread_null.cocci b/tools/coccinelle/struct_thread_null.cocci new file mode 100644 index 0000000000..4867b4454b --- /dev/null +++ b/tools/coccinelle/struct_thread_null.cocci @@ -0,0 +1,9 @@ +@@ +identifier I; +identifier func =~ "thread_add_"; +struct thread *thread; +@@ + +*thread = NULL; +... +func diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index d0b4be81d4..40749e8fc2 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -361,7 +361,6 @@ static int restart_kill(struct thread *t_kill) (long)delay.tv_sec, (restart->kills ? SIGKILL : SIGTERM)); kill(-restart->pid, (restart->kills ? SIGKILL : SIGTERM)); restart->kills++; - restart->t_kill = NULL; thread_add_timer(master, restart_kill, restart, gs.restart_timeout, &restart->t_kill); return 0; @@ -495,7 +494,6 @@ static int run_job(struct restart_info *restart, const char *cmdtype, char cmd[strlen(command) + strlen(restart->name) + 1]; snprintf(cmd, sizeof(cmd), command, restart->name); if ((restart->pid = run_background(cmd)) > 0) { - restart->t_kill = NULL; thread_add_timer(master, restart_kill, restart, gs.restart_timeout, &restart->t_kill); restart->what = cmdtype; @@ -833,10 +831,8 @@ static int try_connect(struct daemon *dmn) zlog_debug("%s: connection in progress", dmn->name); dmn->state = DAEMON_CONNECTING; dmn->fd = sock; - dmn->t_write = NULL; thread_add_write(master, check_connect, dmn, dmn->fd, &dmn->t_write); - dmn->t_wakeup = NULL; thread_add_timer(master, wakeup_connect_hanging, dmn, gs.timeout, &dmn->t_wakeup); SET_READ_HANDLER(dmn); @@ -1022,7 +1018,6 @@ static int wakeup_send_echo(struct thread *t_wakeup) daemon_down(dmn, why); } else { gettimeofday(&dmn->echo_sent, NULL); - dmn->t_wakeup = NULL; thread_add_timer(master, wakeup_no_answer, dmn, gs.timeout, &dmn->t_wakeup); } @@ -1269,7 +1264,6 @@ static void watchfrr_init(int argc, char **argv) gs.numdaemons++; gs.numdown++; dmn->fd = -1; - dmn->t_wakeup = NULL; thread_add_timer_msec(master, wakeup_init, dmn, 0, &dmn->t_wakeup); dmn->restart.interval = gs.min_restart_interval; diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 66a6bd0545..f141b72719 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -112,7 +112,6 @@ int irdp_sock_init(void) return ret; }; - t_irdp_raw = NULL; thread_add_read(zrouter.master, irdp_read_raw, NULL, sock, &t_irdp_raw); return sock; diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 7d67c42a79..5601b13a92 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -233,7 +233,6 @@ int irdp_read_raw(struct thread *r) int ret, ifindex = 0; int irdp_sock = THREAD_FD(r); - t_irdp_raw = NULL; thread_add_read(zrouter.master, irdp_read_raw, NULL, irdp_sock, &t_irdp_raw); diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 054015846f..61f97ce6a9 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -346,7 +346,6 @@ void zebra_ns_notify_init(void) { int fd_monitor; - zebra_netns_notify_current = NULL; fd_monitor = inotify_init(); if (fd_monitor < 0) { flog_err_sys(