[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] libcacard: Fix compilation for older versions of gl

From: Stefan Weil
Subject: [Qemu-devel] [PATCH] libcacard: Fix compilation for older versions of glib (bug #1258168)
Date: Thu, 5 Dec 2013 18:24:06 +0100

See https://bugs.launchpad.net/bugs/1258168

libcacard/vscclient.c: In function 'do_socket_read':
libcacard/vscclient.c:410: warning: implicit declaration of function 
libcacard/vscclient.c:410: warning: nested extern declaration of 
libcacard/vscclient.c: In function 'main':
libcacard/vscclient.c:763: warning: implicit declaration of function 
libcacard/vscclient.c:763: warning: nested extern declaration of 
libcacard/vscclient.o: In function `do_socket_read':
libcacard/vscclient.c:410: undefined reference to `g_warn_if_reached'
libcacard/vscclient.o: In function `main':
libcacard/vscclient.c:763: undefined reference to `g_byte_array_unref'

g_warn_if_reached was added in glib 2.16, and g_byte_array_unref is
supported since glib 2.22. QEMU requires glib 2.16, so both names must
not be used.

Instead of showing a warning for code which should not be reached, QEMU
better stops running, so g_warn_if_reached is not useful for QEMU.

In libcacard/vsclient.c, g_byte_array_unref can be replaced by
g_byte_array_free. This is not generally true, so adding a compatibility
layer in include/glib-compat.h is no option here.

Reported-by: Laurent Desnogues <address@hidden>
Reported-by: Don Slutz <address@hidden>
Signed-off-by: Stefan Weil <address@hidden>
 libcacard/vscclient.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c
index a3cb776..138b9e5 100644
--- a/libcacard/vscclient.c
+++ b/libcacard/vscclient.c
@@ -407,7 +407,7 @@ do_socket_read(GIOChannel *source,
-            g_warn_if_reached();
+            g_assert_not_reached();
             return FALSE;
@@ -760,7 +760,7 @@ main(
-    g_byte_array_unref(socket_to_send);
+    g_byte_array_free(socket_to_send);
     return 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]