Skip to content

Commit

Permalink
Slightly optimise file reader
Browse files Browse the repository at this point in the history
  • Loading branch information
suchmememanyskill committed Jan 23, 2024
1 parent 2a2fff2 commit dd20c11
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CYD-Klipper/src/core/files_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ FILESYSTEM_FILE* get_files(int limit){

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);
if (f.name == NULL){
Serial.println("Failed to allocate memory");
Expand Down

0 comments on commit dd20c11

Please sign in to comment.