Просмотр исходного кода

change: lfs_conf.h 无需调试信息,无需引入inttypes.h, 使用luat_heap_xxx的内存方法

Wendal Chen 4 лет назад
Родитель
Сommit
beb6c6d40f
1 измененных файлов с 11 добавлено и 3 удалено
  1. 11 3
      luat/packages/lfs/lfs_util.h

+ 11 - 3
luat/packages/lfs/lfs_util.h

@@ -23,7 +23,15 @@
 #include <stdint.h>
 #include <stdbool.h>
 #include <string.h>
-#include <inttypes.h>
+
+//--------------------------------
+//#include <inttypes.h>
+#include "luat_malloc.h"
+#define LFS_NO_ASSERT 1
+#define LFS_NO_DEBUG 1
+#define LFS_NO_WARN 1
+#define LFS_NO_ERROR 1
+//--------------------------------
 
 #ifndef LFS_NO_MALLOC
 #include <stdlib.h>
@@ -205,7 +213,7 @@ uint32_t lfs_crc(uint32_t crc, const void *buffer, size_t size);
 // Note, memory must be 64-bit aligned
 static inline void *lfs_malloc(size_t size) {
 #ifndef LFS_NO_MALLOC
-    return malloc(size);
+    return luat_heap_malloc(size);
 #else
     (void)size;
     return NULL;
@@ -215,7 +223,7 @@ static inline void *lfs_malloc(size_t size) {
 // Deallocate memory, only used if buffers are not provided to littlefs
 static inline void lfs_free(void *p) {
 #ifndef LFS_NO_MALLOC
-    free(p);
+    luat_heap_free(p);
 #else
     (void)p;
 #endif