diff options
author | bluhm <bluhm@openbsd.org> | 2010-07-06 13:15:32 +0000 |
---|---|---|
committer | bluhm <bluhm@openbsd.org> | 2010-07-06 13:15:32 +0000 |
commit | f11dc975a9e07e7df0c30f0b0985bd0c5192391a (patch) | |
tree | ad25fbe587810a8ca631fff52fffb03450013e1c /usr.sbin/ospf6d | |
parent | Adapt code to adhere to the comment (now that doesn't happen very often!). (diff) | |
download | wireguard-openbsd-f11dc975a9e07e7df0c30f0b0985bd0c5192391a.tar.xz wireguard-openbsd-f11dc975a9e07e7df0c30f0b0985bd0c5192391a.zip |
Use the static variable narea only where needed for config reload.
The other imessages use the stack variables area and iface.
ok claudio@
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r-- | usr.sbin/ospf6d/ospfe.c | 30 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde.c | 19 |
2 files changed, 25 insertions, 24 deletions
diff --git a/usr.sbin/ospf6d/ospfe.c b/usr.sbin/ospf6d/ospfe.c index 6fb6f7308cc..770f4768d48 100644 --- a/usr.sbin/ospf6d/ospfe.c +++ b/usr.sbin/ospf6d/ospfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.c,v 1.31 2010/07/01 19:47:04 bluhm Exp $ */ +/* $OpenBSD: ospfe.c,v 1.32 2010/07/06 13:15:32 bluhm Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -249,15 +249,15 @@ void ospfe_dispatch_main(int fd, short event, void *bula) { static struct area *narea; - static struct iface *niface; + struct area *area; + struct iface *iface, *ifp; struct ifaddrchange *ifc; struct iface_addr *ia, *nia; - struct imsg imsg; - struct imsgev *iev = bula; - struct imsgbuf *ibuf = &iev->ibuf; - struct iface *iface, *ifp; - int n, stub_changed, shut = 0; - unsigned int ifindex; + struct imsg imsg; + struct imsgev *iev = bula; + struct imsgbuf *ibuf = &iev->ibuf; + int n, stub_changed, shut = 0; + unsigned int ifindex; if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) @@ -299,16 +299,16 @@ ospfe_dispatch_main(int fd, short event, void *bula) } break; case IMSG_IFADD: - if ((niface = malloc(sizeof(struct iface))) == NULL) + if ((iface = malloc(sizeof(struct iface))) == NULL) fatal(NULL); - memcpy(niface, imsg.data, sizeof(struct iface)); + memcpy(iface, imsg.data, sizeof(struct iface)); - LIST_INIT(&niface->nbr_list); - TAILQ_INIT(&niface->ls_ack_list); - RB_INIT(&niface->lsa_tree); + LIST_INIT(&iface->nbr_list); + TAILQ_INIT(&iface->ls_ack_list); + RB_INIT(&iface->lsa_tree); - narea = area_find(oeconf, niface->area_id); - LIST_INSERT_HEAD(&narea->iface_list, niface, entry); + area = area_find(oeconf, iface->area_id); + LIST_INSERT_HEAD(&area->iface_list, iface, entry); break; case IMSG_IFDELETE: if (imsg.hdr.len != IMSG_HEADER_SIZE + diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c index 48c14d78f3e..b235edff1a7 100644 --- a/usr.sbin/ospf6d/rde.c +++ b/usr.sbin/ospf6d/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.46 2010/07/05 22:59:51 bluhm Exp $ */ +/* $OpenBSD: rde.c,v 1.47 2010/07/06 13:15:33 bluhm Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -623,7 +623,8 @@ void rde_dispatch_parent(int fd, short event, void *bula) { static struct area *narea; - struct iface *niface, *iface; + struct area *area; + struct iface *iface; struct imsg imsg; struct kroute kr; struct rroute rr; @@ -708,16 +709,16 @@ rde_dispatch_parent(int fd, short event, void *bula) 0, -1, &kr, sizeof(kr)); break; case IMSG_IFADD: - if ((niface = malloc(sizeof(struct iface))) == NULL) + if ((iface = malloc(sizeof(struct iface))) == NULL) fatal(NULL); - memcpy(niface, imsg.data, sizeof(struct iface)); + memcpy(iface, imsg.data, sizeof(struct iface)); - LIST_INIT(&niface->nbr_list); - TAILQ_INIT(&niface->ls_ack_list); - RB_INIT(&niface->lsa_tree); + LIST_INIT(&iface->nbr_list); + TAILQ_INIT(&iface->ls_ack_list); + RB_INIT(&iface->lsa_tree); - narea = area_find(rdeconf, niface->area_id); - LIST_INSERT_HEAD(&narea->iface_list, niface, entry); + area = area_find(rdeconf, iface->area_id); + LIST_INSERT_HEAD(&area->iface_list, iface, entry); break; case IMSG_IFDELETE: if (imsg.hdr.len != IMSG_HEADER_SIZE + |