From 2725a4ca14fb29f897d905d9de0e3c9c1925e597 Mon Sep 17 00:00:00 2001 From: "Chas Williams (CONTRACTOR)" Date: Mon, 24 Sep 2012 16:26:43 -0400 Subject: [PATCH] budb: Avoid use of anonymous structures to determine size Change-Id: Ife337e4e020a0450020f9ae641b1711435b936c4 Reviewed-on: http://gerrit.openafs.org/8153 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk Reviewed-by: Perry Ruiter Reviewed-by: Jeffrey Altman --- src/budb/database.h | 8 ++++---- src/budb/db_alloc.c | 8 ++++---- src/budb/ol_verify.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/budb/database.h b/src/budb/database.h index 3b8f67177..b808234ea 100644 --- a/src/budb/database.h +++ b/src/budb/database.h @@ -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]; diff --git a/src/budb/db_alloc.c b/src/budb/db_alloc.c index 48468c56a..9a7c28c99 100644 --- a/src/budb/db_alloc.c +++ b/src/budb/db_alloc.c @@ -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; } diff --git a/src/budb/ol_verify.c b/src/budb/ol_verify.c index aeb3cdf81..8baeccca9 100644 --- a/src/budb/ol_verify.c +++ b/src/budb/ol_verify.c @@ -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, }; -- 2.39.5