From 8763084a9e7be9b20a69bb99e3622185ae4c7c3e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 19 Mar 2024 06:09:41 +1100 Subject: [PATCH] AP_Filesystem: avoid decompressing in directory listing this makes ROMFS much more efficient --- libraries/AP_Filesystem/AP_Filesystem_ROMFS.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries/AP_Filesystem/AP_Filesystem_ROMFS.cpp b/libraries/AP_Filesystem/AP_Filesystem_ROMFS.cpp index 0175bc19ff..930b4f6268 100644 --- a/libraries/AP_Filesystem/AP_Filesystem_ROMFS.cpp +++ b/libraries/AP_Filesystem/AP_Filesystem_ROMFS.cpp @@ -119,12 +119,10 @@ int32_t AP_Filesystem_ROMFS::lseek(int fd, int32_t offset, int seek_from) int AP_Filesystem_ROMFS::stat(const char *name, struct stat *stbuf) { uint32_t size; - const uint8_t *data = AP_ROMFS::find_decompress(name, size); - if (data == nullptr) { + if (!AP_ROMFS::find_size(name, size)) { errno = ENOENT; return -1; } - AP_ROMFS::free(data); memset(stbuf, 0, sizeof(*stbuf)); stbuf->st_size = size; return 0;