summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabiano Fidêncio <fidencio@redhat.com>2018-12-17 12:26:44 +0100
committerFabiano Fidêncio <fidencio@redhat.com>2018-12-20 11:05:56 +0100
commit9cd70495203e1f60cdf2f3ea3406b5c0851f6097 (patch)
tree1d643a022aad0f15a9d1ae8e0e69b08fb297426a
parent580c71340b2fef7baf50ad24dc8d8d54b7a0f278 (diff)
downloadlibosinfo-9cd70495203e1f60cdf2f3ea3406b5c0851f6097.tar.gz
media: Use G_STATIC_ASSERT()
Let's use G_STATIC_ASSERT() instead of creating a dummy array to check the size of the _PrimaryVolumeDescriptor struct. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r--osinfo/osinfo_media.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index 1ee1fa5..cf1cf91 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -59,10 +59,9 @@ struct _PrimaryVolumeDescriptor {
/* the PrimaryVolumeDescriptor struct must exactly 2048 bytes long
* since we expect the supplementary volume descriptor to be right
- * after it. The magic declaration below ensures we get a compilatin
- * error if its size is not correct
+ * after it.
*/
-char dummy[sizeof(struct _PrimaryVolumeDescriptor) == 2048 ? 1 : -1];
+G_STATIC_ASSERT(sizeof(struct _PrimaryVolumeDescriptor) == 2048);
typedef struct _SupplementaryVolumeDescriptor SupplementaryVolumeDescriptor;