budb: Avoid use of anonymous structures to determine size
authorChas Williams (CONTRACTOR) <chas@cmf.nrl.navy.mil>
Mon, 24 Sep 2012 20:26:43 +0000 (16:26 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Sun, 7 Dec 2014 00:55:40 +0000 (19:55 -0500)
Change-Id: Ife337e4e020a0450020f9ae641b1711435b936c4
Reviewed-on: http://gerrit.openafs.org/8153
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/budb/database.h
src/budb/db_alloc.c
src/budb/ol_verify.c

index 3b8f671..b808234 100644 (file)
@@ -148,7 +148,7 @@ struct volFragment {
 #define NvolFragmentS 45
 struct vfBlock {
     struct blockHeader h;
-    struct {
+    struct vfBlock_frag {
        struct volFragment s;
        char pad[4];
     } a[NvolFragmentS];
@@ -176,7 +176,7 @@ struct volInfo {
 #define NvolInfoS 20
 struct viBlock {
     struct blockHeader h;
-    struct {
+    struct viBlock_info {
        struct volInfo s;
        char pad[4];
     } a[NvolInfoS];
@@ -211,7 +211,7 @@ struct tape {
 #define NtapeS 20
 struct tBlock {
     struct blockHeader h;
-    struct {
+    struct tBlock_tape {
        struct tape s;
        char pad[8];
     } a[NtapeS];
@@ -249,7 +249,7 @@ typedef dbDumpT *dbDumpP;
 #define NdumpS 3
 struct dBlock {
     struct blockHeader h;
-    struct {
+    struct dBlock_dump {
        struct dump s;
        char pad[44];
     } a[NdumpS];
index 48468c5..9a7c28c 100644 (file)
@@ -36,10 +36,10 @@ InitDBalloc(void)
     nEntries[tape_BLOCK] = NtapeS;
     nEntries[dump_BLOCK] = NdumpS;
 
-    sizeEntries[volFragment_BLOCK] = sizeof(((struct vfBlock *) NULL)->a[0]);
-    sizeEntries[volInfo_BLOCK] = sizeof(((struct viBlock *) NULL)->a[0]);
-    sizeEntries[tape_BLOCK] = sizeof(((struct tBlock *) NULL)->a[0]);
-    sizeEntries[dump_BLOCK] = sizeof(((struct dBlock *) NULL)->a[0]);
+    sizeEntries[volFragment_BLOCK] = sizeof(struct vfBlock_frag);
+    sizeEntries[volInfo_BLOCK] = sizeof(struct viBlock_info);
+    sizeEntries[tape_BLOCK] = sizeof(struct tBlock_tape);
+    sizeEntries[dump_BLOCK] = sizeof(struct dBlock_dump);
 
     return 0;
 }
index aeb3cdf..8baeccc 100644 (file)
@@ -129,10 +129,10 @@ int blockEntries[NBLOCKTYPES] = {
 
 int blockEntrySize[NBLOCKTYPES] = {
     0 /* free */ ,
-    sizeof(((struct vfBlock *) NULL)->a[0]),
-    sizeof(((struct viBlock *) NULL)->a[0]),
-    sizeof(((struct tBlock *) NULL)->a[0]),
-    sizeof(((struct dBlock *) NULL)->a[0]),
+    sizeof(struct vfBlock_frag),
+    sizeof(struct viBlock_info),
+    sizeof(struct tBlock_tape),
+    sizeof(struct dBlock_dump),
     0,
     0,
 };