mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-03-21 13:43:25 +00:00
Slightly optimise file reader
This commit is contained in:
@@ -53,8 +53,10 @@ FILESYSTEM_FILE* get_files(int limit){
|
|||||||
|
|
||||||
file_iter++;
|
file_iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (file_iter == files.end() && files.size() >= limit)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Little inefficient as it always allocates a string, even if it doesn't have to
|
|
||||||
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");
|
||||||
|
|||||||
Reference in New Issue
Block a user