Slightly optimise file reader

This commit is contained in:
suchmememanyskill
2024-01-23 20:07:06 +01:00
parent 2a2fff27d6
commit dd20c11d8b

View File

@@ -54,7 +54,9 @@ FILESYSTEM_FILE* get_files(int limit){
file_iter++; file_iter++;
} }
// Little inefficient as it always allocates a string, even if it doesn't have to if (file_iter == files.end() && files.size() >= limit)
continue;
f.name = (char*)malloc(strlen(path) + 1); f.name = (char*)malloc(strlen(path) + 1);
if (f.name == NULL){ if (f.name == NULL){
Serial.println("Failed to allocate memory"); Serial.println("Failed to allocate memory");