diff options
author | mav <mav@FreeBSD.org> | 2008-04-19 05:30:49 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2008-04-19 05:30:49 +0000 |
commit | d2bb3d9ce8eee16fd69ee784a70fcc277c94d2af (patch) | |
tree | c2fe558bdc15b87d7d807cbde8492bd64bc9129e /sys/netgraph | |
parent | 4f133b2d11568f9e495cfa76ed1a61bed8b4c81c (diff) | |
download | FreeBSD-src-d2bb3d9ce8eee16fd69ee784a70fcc277c94d2af.zip FreeBSD-src-d2bb3d9ce8eee16fd69ee784a70fcc277c94d2af.tar.gz |
ng_address_hook() microoptimization. Use local variables as they should be.
It helps compiller to avoid some extra memory accesses.
Diffstat (limited to 'sys/netgraph')
-rw-r--r-- | sys/netgraph/ng_base.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 9e7acef..12256b0 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -3420,10 +3420,10 @@ ng_address_hook(node_p here, item_p item, hook_p hook, ng_ID_t retaddr) * that the peer is still connected (even if invalid,) we know * that the peer node is present, though maybe invalid. */ - if ((hook == NULL) - || NG_HOOK_NOT_VALID(hook) - || NG_HOOK_NOT_VALID(NG_HOOK_PEER(hook)) - || NG_NODE_NOT_VALID(NG_PEER_NODE(hook))) { + if ((hook == NULL) || + NG_HOOK_NOT_VALID(hook) || + NG_HOOK_NOT_VALID(peer = NG_HOOK_PEER(hook)) || + NG_NODE_NOT_VALID(peernode = NG_PEER_NODE(hook))) { NG_FREE_ITEM(item); TRAP_ERROR(); return (ENETDOWN); @@ -3432,11 +3432,9 @@ ng_address_hook(node_p here, item_p item, hook_p hook, ng_ID_t retaddr) /* * Transfer our interest to the other (peer) end. */ - peer = NG_HOOK_PEER(hook); NG_HOOK_REF(peer); - NGI_SET_HOOK(item, peer); - peernode = NG_PEER_NODE(hook); NG_NODE_REF(peernode); + NGI_SET_HOOK(item, peer); NGI_SET_NODE(item, peernode); SET_RETADDR(item, here, retaddr); return (0); |