Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Haster <geky@geky.net>2024-01-16 09:27:07 +0300
committerChristopher Haster <geky@geky.net>2024-01-16 09:27:07 +0300
commit60567677b95205d50d98815d073a5f466d052e68 (patch)
tree88048fdbb422dce10d0f85ef042d6b2934610b8e
parentb1b10c0e7559adcb7f2600e7bb7b5cf481d02d0d (diff)
Relaxed alignment requirements for lfs_mallocrelaxed-lookahead
The only reason we needed this alignment was for the lookahead buffer. Now that the lookahead buffer is relaxed to operate on bytes, we can relax our malloc alignment requirement all the way down to the byte level, since we mainly use lfs_malloc to allocate byte-level buffers. This does introduce a risk that we might need word-level mallocs in the future. If that happens we will need to decide if changing the malloc alignment is a breaking change, or gate alignment requirements behind user provided defines. Found by HiFiPhile.
-rw-r--r--lfs_util.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/lfs_util.h b/lfs_util.h
index 13e9396..8248d1d 100644
--- a/lfs_util.h
+++ b/lfs_util.h
@@ -215,7 +215,9 @@ static inline uint32_t lfs_tobe32(uint32_t a) {
uint32_t lfs_crc(uint32_t crc, const void *buffer, size_t size);
// Allocate memory, only used if buffers are not provided to littlefs
-// Note, memory must be 64-bit aligned
+//
+// littlefs current has no alignment requirements, as it only allocates
+// byte-level buffers.
static inline void *lfs_malloc(size_t size) {
#ifndef LFS_NO_MALLOC
return malloc(size);