]>
Commit | Line | Data |
---|---|---|
d63c9477 AL |
1 | /* |
2 | * GLIB Compatibility Functions | |
3 | * | |
4 | * Copyright IBM, Corp. 2013 | |
5 | * | |
6 | * Authors: | |
7 | * Anthony Liguori <aliguori@us.ibm.com> | |
86946a2d MT |
8 | * Michael Tokarev <mjt@tls.msk.ru> |
9 | * Paolo Bonzini <pbonzini@redhat.com> | |
d63c9477 AL |
10 | * |
11 | * This work is licensed under the terms of the GNU GPL, version 2 or later. | |
12 | * See the COPYING file in the top-level directory. | |
13 | * | |
14 | */ | |
15 | ||
16 | #ifndef QEMU_GLIB_COMPAT_H | |
17 | #define QEMU_GLIB_COMPAT_H | |
18 | ||
19 | #include <glib.h> | |
20 | ||
1706e9d8 | 21 | #if defined(_WIN32) && !GLIB_CHECK_VERSION(2, 50, 0) |
5a007547 SP |
22 | /* |
23 | * g_poll has a problem on Windows when using | |
24 | * timeouts < 10ms, so use wrapper. | |
25 | */ | |
26 | #define g_poll(fds, nfds, timeout) g_poll_fixed(fds, nfds, timeout) | |
27 | gint g_poll_fixed(GPollFD *fds, guint nfds, gint timeout); | |
f95c967a SH |
28 | #endif |
29 | ||
8a0b5421 MAL |
30 | |
31 | #ifndef g_assert_cmpmem | |
32 | #define g_assert_cmpmem(m1, l1, m2, l2) \ | |
33 | do { \ | |
34 | gconstpointer __m1 = m1, __m2 = m2; \ | |
35 | int __l1 = l1, __l2 = l2; \ | |
36 | if (__l1 != __l2) { \ | |
37 | g_assertion_message_cmpnum( \ | |
38 | G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ | |
39 | #l1 " (len(" #m1 ")) == " #l2 " (len(" #m2 "))", __l1, "==", \ | |
40 | __l2, 'i'); \ | |
41 | } else if (memcmp(__m1, __m2, __l1) != 0) { \ | |
42 | g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ | |
43 | "assertion failed (" #m1 " == " #m2 ")"); \ | |
44 | } \ | |
45 | } while (0) | |
46 | #endif | |
47 | ||
d63c9477 | 48 | #endif |