main-loop: do not include slirp/slirp.h, use libslirp.h instead
PATCH 1/1 main-loop: do not include slirp/slirp.h, use libslirp.h instead
The header slirp/slirp.h is an internal header for slirp, and main-loop.c does not use internals from there. Instead, it uses public functions (slirp_update_timeout(), slirp_pollfds_fill() etc) which are declared in qemu/libslirp.h.
Including slirp/slirp.h is somewhat dangerous since it redefines errno on WIN32, so any file including it may misbehave wrt errno.
Unfortunately libslirp isn't self-contained, it needs declaration of struct in_addr, which is provided by qemu/sockets.h. Maybe instead of #including qemu/sockets.h before libslirp.h, it is better to make the latter self-contained.
--- main-loop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
main-loop.c +2 -1
@@ -24,7 +24,8 @@#include "qemu-common.h" #include "qemu/timer.h" -#include "slirp/slirp.h" +#include "qemu/sockets.h" // struct in_addr needed for libslirp.h +#include "slirp/libslirp.h" #include "qemu/main-loop.h" #include "block/aio.h"
Signature · 1 line
1.7.10.4
Il 12/06/2013 08:36, Michael Tokarev ha scritto:
Quoted 8 lines
Including
slirp/slirp.his somewhat dangerous since it redefines errno on WIN32, so any file including it may misbehave wrt errno.Unfortunately libslirp isn't self-contained, it needs declaration of struct
in_addr, which is provided byqemu/sockets.h. Maybe instead of #includingqemu/sockets.hbeforelibslirp.h, it is better to make the latter self-contained.
Yeah, but I agree with having the smallest patch for now.