mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-11-15 21:45:55 +00:00
Slightly optimise file reader
This commit is contained in:
1 parent
2a2fff27d6
commit
dd20c11d8b
1 file changed
+3
-1
@@ -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");
|
||||||
|
|||||||
Reference in new issue
Block a user