* [Qemu-devel] [PATCH trivial] main-loop: do not include slirp/slirp.h, use libslirp.h instead
@ 2013-06-12 12:36 Michael Tokarev
2013-06-12 12:50 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Michael Tokarev @ 2013-06-12 12:36 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev
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.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
main-loop.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/main-loop.c b/main-loop.c
index cf36645..a44fff6 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -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"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH trivial] main-loop: do not include slirp/slirp.h, use libslirp.h instead
2013-06-12 12:36 [Qemu-devel] [PATCH trivial] main-loop: do not include slirp/slirp.h, use libslirp.h instead Michael Tokarev
@ 2013-06-12 12:50 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2013-06-12 12:50 UTC (permalink / raw)
To: Michael Tokarev; +Cc: qemu-trivial, qemu-devel
Il 12/06/2013 08:36, Michael Tokarev ha scritto:
>
> 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.
Yeah, but I agree with having the smallest patch for now.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-06-12 12:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 12:36 [Qemu-devel] [PATCH trivial] main-loop: do not include slirp/slirp.h, use libslirp.h instead Michael Tokarev
2013-06-12 12:50 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).