mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 17:24:26 +00:00
Merge pull request #9731 from ton31337/fix/thread_null_set
cleanup: struct thread = NULL
This commit is contained in:
commit
334d9d259f
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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]);
|
||||
}
|
||||
|
9
tools/coccinelle/struct_thread_null.cocci
Normal file
9
tools/coccinelle/struct_thread_null.cocci
Normal file
@ -0,0 +1,9 @@
|
||||
@@
|
||||
identifier I;
|
||||
identifier func =~ "thread_add_";
|
||||
struct thread *thread;
|
||||
@@
|
||||
|
||||
*thread = NULL;
|
||||
...
|
||||
func
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user