src/liboping.c: Start refactoring ping_send().
authorFlorian Forster <ff@octo.it>
Fri, 5 May 2017 08:07:19 +0000 (10:07 +0200)
committerFlorian Forster <ff@octo.it>
Fri, 5 May 2017 08:47:26 +0000 (10:47 +0200)
commit4ef7c73e336179f61a432f087090cc48ffce3478
tree847cc802cc105f4d859d44844d424c8b48217d66
parent450f754967e543d3b19a9bc7ae796e26b5565ecc
src/liboping.c: Start refactoring ping_send().

* Avoid the unnecessary copies of obj->head (ph), obj->fd4 (fd4) and
  obj->fd6 (fd6). Assigning these to local variables suggests that the
  decoupling is necessary, which is confusing when this is not really the
  case.
* Only scan for IPv4 and IPv6 hosts when resetting their latency and TTL
  and make sure appropriate sockets are open outside of the loop. This
  makes it easier to read and understand under which circumstances which
  socket is opened.
* Move some variables to inside the while loop.
src/liboping.c