Dropped LFSR_DATA_* macros with implicit buffers
This was a disappointing failure of compount-literals.
These macros protect against mismatched buffer sizes, which is great for
preventing bugs caused by simple typos, but the overhead of compound-
literals requiring initialization make them simply unusable.
This commit leaves only a couple macros with implicit buffers:
LFSR_DATA_LEB128, and the LFSR_RAT_CAT/LFSR_RATS macros.
Even the tiny cleanup of the one remaining implicit-buffer macro still
in use, LFSR_DATA_GEOMETRY, saved some code:
code stack ctx
before: 38084 2608 752
after: 38060 (-0.1%) 2608 (+0.0%) 752 (+0.0%)
This commit is contained in:
+12
-6
@@ -908,12 +908,15 @@ code = '''
|
||||
// note we're messing around with internals to do this! this
|
||||
// is not a user API
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
uint8_t geometry_buf[LFSR_GEOMETRY_DSIZE];
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_RATS(
|
||||
LFSR_RAT(
|
||||
LFSR_TAG_GEOMETRY, 0,
|
||||
LFSR_DATA_GEOMETRY((&(lfsr_geometry_t){
|
||||
INC_BLOCK_SIZE,
|
||||
BLOCK_COUNT}))))) => 0;
|
||||
LFSR_DATA_GEOMETRY(
|
||||
(&(lfsr_geometry_t){
|
||||
INC_BLOCK_SIZE,
|
||||
BLOCK_COUNT}),
|
||||
geometry_buf)))) => 0;
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
|
||||
// mount should now fail
|
||||
@@ -935,12 +938,15 @@ code = '''
|
||||
// note we're messing around with internals to do this! this
|
||||
// is not a user API
|
||||
lfsr_mount(&lfs, LFS_M_RDWR, CFG) => 0;
|
||||
uint8_t geometry_buf[LFSR_GEOMETRY_DSIZE];
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_RATS(
|
||||
LFSR_RAT(
|
||||
LFSR_TAG_GEOMETRY, 0,
|
||||
LFSR_DATA_GEOMETRY((&(lfsr_geometry_t){
|
||||
BLOCK_SIZE,
|
||||
INC_BLOCK_COUNT}))))) => 0;
|
||||
LFSR_DATA_GEOMETRY(
|
||||
(&(lfsr_geometry_t){
|
||||
BLOCK_SIZE,
|
||||
INC_BLOCK_COUNT}),
|
||||
geometry_buf)))) => 0;
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
|
||||
// mount should now fail
|
||||
|
||||
Reference in New Issue
Block a user