OSDN Git Service

cleanup: use verify, not PED_ASSERT to check struct sizes
authorJim Meyering <meyering@redhat.com>
Mon, 25 Oct 2010 19:44:31 +0000 (21:44 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 23 Feb 2011 09:30:59 +0000 (10:30 +0100)
* libparted/labels/gpt.c: Use compile-time "verify" rather than
run-time PED_ASSERT to ensure struct sizes are as expected.

libparted/labels/gpt.c

index b9ed5c3..fad352f 100644 (file)
@@ -40,6 +40,7 @@
 #include <stdbool.h>
 #include <errno.h>
 #include "xalloc.h"
+#include "verify.h"
 
 #include "pt-tools.h"
 
@@ -69,6 +70,8 @@ typedef struct _GuidPartitionEntry_t GuidPartitionEntry_t;
 typedef struct _PartitionRecord_t PartitionRecord_t;
 typedef struct _LegacyMBR_t LegacyMBR_t;
 typedef struct _GPTDiskData GPTDiskData;
+
+
 typedef struct
 {
   uint32_t time_low;
@@ -1777,9 +1780,6 @@ static PedDiskType gpt_disk_type =
 void
 ped_disk_gpt_init ()
 {
-  PED_ASSERT (sizeof (GuidPartitionEntryAttributes_t) == 8, return);
-  PED_ASSERT (sizeof (GuidPartitionEntry_t) == 128, return);
-
   ped_disk_type_register (&gpt_disk_type);
 }
 
@@ -1788,3 +1788,6 @@ ped_disk_gpt_done ()
 {
   ped_disk_type_unregister (&gpt_disk_type);
 }
+
+verify (sizeof (GuidPartitionEntryAttributes_t) == 8);
+verify (sizeof (GuidPartitionEntry_t) == 128);