Prefer tag/size outside of union where possible
If we have control of the struct, such as in lfsr_data_t and lfsr_cat_t,
moving the common tag outside of the union avoids naming ambiguities.
Counter-example: This doesn't work for lfsr_bshrub_t, since the contents
of that union are also used as separate types elsewhere. Fortunately the
common initial sequence union rules kick in here.
No code changes, which is good:
code stack
before: 33652 2624
after: 33652 (+0.0%) 2624 (+0.0%)
This commit is contained in:
@@ -397,17 +397,13 @@ typedef struct lfs_mdir {
|
||||
typedef struct lfsr_data {
|
||||
// sign(size)=0 => in-RAM buffer
|
||||
// sign(size)=1 => on-disk reference
|
||||
lfs_size_t size;
|
||||
union {
|
||||
lfs_size_t size;
|
||||
struct {
|
||||
lfs_size_t size;
|
||||
lfs_block_t block;
|
||||
lfs_size_t off;
|
||||
} disk;
|
||||
struct {
|
||||
lfs_size_t size;
|
||||
const uint8_t *buffer;
|
||||
} buf;
|
||||
const uint8_t *buffer;
|
||||
} u;
|
||||
} lfsr_data_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user