ping: move global variables to runtime config structure
Primary reason to do this change is to make it clear when a variable is
local, and when it is originating to runtime state -- that is basically the
former global variables. Aim is to make code a lot cleaner, easier to work,
and lower mental strain when needing to debug ping.
Secondly having a state structure available will allow many follow up
improvements, such moving all allocations to state and make clean up routine
at exit to work without need to get back to main() to free resources. With
quick look other improvements could include some IPv4 / IPv6 code
deduplications, and possibly moving from sigaction() to signalfd() and event
loop. But we'll see what happens in future.
Signed-off-by:
Sami Kerola <kerolasa@iki.fi>
Loading