Fix lockstep plugin with old glib2
This commit is contained in:
parent
d86aae8ed9
commit
1f0aad9814
@ -33,6 +33,25 @@
|
||||
|
||||
#include <qemu-plugin.h>
|
||||
|
||||
static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size)
|
||||
{
|
||||
#if GLIB_CHECK_VERSION(2, 68, 0)
|
||||
return g_memdup2(mem, byte_size);
|
||||
#else
|
||||
gpointer new_mem;
|
||||
|
||||
if (mem && byte_size != 0) {
|
||||
new_mem = g_malloc(byte_size);
|
||||
memcpy(new_mem, mem, byte_size);
|
||||
} else {
|
||||
new_mem = NULL;
|
||||
}
|
||||
|
||||
return new_mem;
|
||||
#endif
|
||||
}
|
||||
#define g_memdup2(m, s) g_memdup2_qemu(m, s)
|
||||
|
||||
QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
|
||||
|
||||
/* saved so we can uninstall later */
|
||||
|
Loading…
x
Reference in New Issue
Block a user