AmendHub

Download:

jcs

/

subtext

/

amendments

/

526

folder: Faster sort


jcs made amendment 526 9 months ago
--- folder.c Thu Aug 3 09:47:23 2023 +++ folder.c Tue Sep 19 21:10:13 2023 @@ -840,14 +840,14 @@ folder_find_file_ids(struct folder *folder, size_t *nf } /* sort by filename */ - for (i = 0; i < *nfile_ids; i++) { - for (j = 0; j < *nfile_ids - i - 1; j++) { + for (i = 1; i < *nfile_ids; i++) { + for (j = i; j > 0; j--) { if (strcasecmp(name_map[j].filename, - name_map[j + 1].filename) > 0) { - tmp_map = name_map[j]; - name_map[j] = name_map[j + 1]; - name_map[j + 1] = tmp_map; - } + name_map[j - 1].filename) > 0) + break; + tmp_map = name_map[j]; + name_map[j] = name_map[j - 1]; + name_map[j - 1] = tmp_map; } }