Skip to content

Commit

Permalink
AP_Filesystem: avoid decompressing in directory listing
Browse files Browse the repository at this point in the history
this makes ROMFS much more efficient
  • Loading branch information
tridge authored and peterbarker committed Mar 19, 2024
1 parent aa7ae23 commit 8763084
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libraries/AP_Filesystem/AP_Filesystem_ROMFS.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 8763084

Please sign in to comment.