Replace qsort() with mutt_qsort_r() #3952
Closed
flatcap
started this conversation in
Development
Replies: 3 comments 1 reply
-
Do you want to replace all occurences or only the ones that actually would use the data parameter? For consistency it would probably be better to replace all? |
Beta Was this translation helpful? Give feedback.
1 reply
-
I can tackle this. Started here: #3953. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Finished in: 02bd135 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
NeoMutt uses
qsort()
to sort lots of data.It's quick, but some sorting requires extra data, which means global variables.
qsort_r()
is an improved version that takes a data parameter, but it's not consistent across all platforms.mutt_qsort_r()
is a wrapper that hides the implementation details.Replace
qsort()
withmutt_qsort_r()
Below is a list of all the uses of
qsort()
, and their callback functions, including some used inARRAY_SORT()
.Every callback function needs to be checked for:
e.g.
static bool SbSortReverse = false;
Lookups are quick, but they should only be done once
commands.c:818:5:
envlist_sort()
complete/helpers.c:390:5:
label_sort()
config/subset.c:94:3:
elem_list_sort()
imap/imap.c:1570:3:
imap_sort_email_uid()
maildir/maildir.c:234:7:
maildir_sort_flags()
ncrypt/dlg_gpgme.c:735:5:
crypt_compare_address_qsort()
,crypt_compare_date_qsort()
,crypt_compare_keyid_qsort()
,crypt_compare_trust_qsort()
ncrypt/dlg_pgp.c:658:5:
pgp_compare_address_qsort()
,pgp_compare_date_qsort()
,pgp_compare_keyid_qsort()
,pgp_compare_trust_qsort()
alias/sort.c:175:3:
alias_sort_address()
,alias_sort_name()
,alias_sort_name()
,alias_sort_unsort()
browser/sort.c:214:3:
browser_compare()
core/command.c:59:3:
commands_sort()
imap/imap.c:1385:5:
imap_sort_uid()
imap/imap.c:1485:5:
imap_sort_uid()
imap/message.c:1653:3:
imap_sort_uid()
maildir/maildir.c:592:3:
maildir_sort_inode()
maildir/mh.c:674:5:
mh_sort_path()
sidebar/sort.c:205:3:
sb_sort_count()
,sb_sort_desc()
,sb_sort_flagged()
,sb_sort_order()
,sb_sort_path()
,sb_sort_unread()
Beta Was this translation helpful? Give feedback.
All reactions