kv: Some minor file cache_buffer tweaks
- Unconditionally pass buffer as cache_buffer in lfs3_set now that we
rely on LFS3_o_WRSET
- Swapped true -> 1 for non-null don't-care buffer pointer
Saved one instruction as expected for the conditional assignment, but
added a bit of stack. Weird, but probably just compiler noise:
code stack ctx
before: 37836 2408 636
after: 37832 (-0.0%) 2416 (+0.3%) 636 (+0.0%)
This commit is contained in:
@@ -13939,7 +13939,7 @@ int lfs3_file_ckdata(lfs3_t *lfs3, lfs3_file_t *file) {
|
||||
// kv file config, we need to explicitly disable the file cache
|
||||
static const struct lfs3_file_config lfs3_file_kvconfig = {
|
||||
// TODO is this the best way to do this?
|
||||
.cache_buffer = (uint8_t*)true,
|
||||
.cache_buffer = (uint8_t*)1,
|
||||
.cache_size = 0,
|
||||
};
|
||||
|
||||
@@ -13998,7 +13998,7 @@ int lfs3_set(lfs3_t *lfs3, const char *path,
|
||||
// to try to commit small files atomically
|
||||
//
|
||||
struct lfs3_file_config cfg = {
|
||||
.cache_buffer = (buffer) ? (uint8_t*)buffer : (uint8_t*)true,
|
||||
.cache_buffer = (uint8_t*)buffer,
|
||||
.cache_size = size,
|
||||
};
|
||||
lfs3_file_t file;
|
||||
|
||||
Reference in New Issue
Block a user