aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-20 23:54:37 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-22 13:16:17 +0400
commitd8e3c6030b729f581f382e0e7f9334b776ae0982 (patch)
tree6da735f11df3e22e2541cb7a09103a7565742dd3
parent14ec36e107a8c9af7d0a80c3571fe39b291ff1d4 (diff)
downloadslirp-d8e3c6030b729f581f382e0e7f9334b776ae0982.zip
slirp-d8e3c6030b729f581f382e0e7f9334b776ae0982.tar.gz
slirp-d8e3c6030b729f581f382e0e7f9334b776ae0982.tar.bz2
util: add G_SIZEOF_MEMBER() macro
I am (overly?) optimistic this macro will be added to glib: https://gitlab.gnome.org/GNOME/glib/merge_requests/1333 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
-rw-r--r--src/util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 3c6223c..e9c3073 100644
--- a/src/util.h
+++ b/src/util.h
@@ -61,6 +61,10 @@
})
#endif
+#ifndef G_SIZEOF_MEMBER
+#define G_SIZEOF_MEMBER(type, member) sizeof(((type *)0)->member)
+#endif
+
#if defined(_WIN32) /* CONFIG_IOVEC */
#if !defined(IOV_MAX) /* XXX: to avoid duplicate with QEMU osdep.h */
struct iovec {