[PATCH v3 13/16] qemu-common: move glib-compat.h

marcandre.lureau@redhat.com posted 16 patches 3 years, 6 months ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Markus Armbruster <armbru@redhat.com>, Michael Roth <michael.roth@amd.com>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Xie Yongji <xieyongji@bytedance.com>
[PATCH v3 13/16] qemu-common: move glib-compat.h
Posted by marcandre.lureau@redhat.com 3 years, 6 months ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

qemu-common will have compatible dependency requirements with QEMU.

Since qemu-common won't have a toplevel qemu/osdep.h which would include
various system headers, include stdbool.h (bool is used for some
declarations here).

Replace getenv() with g_getenv() to avoid extra header inclusion.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Warner Losh <imp@bsdimp.com>
---
 {include => subprojects/qemu-common/include}/glib-compat.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
 rename {include => subprojects/qemu-common/include}/glib-compat.h (97%)

diff --git a/include/glib-compat.h b/subprojects/qemu-common/include/glib-compat.h
similarity index 97%
rename from include/glib-compat.h
rename to subprojects/qemu-common/include/glib-compat.h
index 43a562974d..2b0f2962f3 100644
--- a/include/glib-compat.h
+++ b/subprojects/qemu-common/include/glib-compat.h
@@ -30,6 +30,8 @@
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
 #include <glib.h>
+#include <stdbool.h>
+
 #if defined(G_OS_UNIX)
 #include <glib-unix.h>
 #include <sys/types.h>
@@ -133,7 +135,7 @@ qemu_g_test_slow(void)
 {
     static int cached = -1;
     if (cached == -1) {
-        cached = g_test_slow() || getenv("G_TEST_SLOW") != NULL;
+        cached = g_test_slow() || g_getenv("G_TEST_SLOW") != NULL;
     }
     return cached;
 }
-- 
2.37.1