Slightly improve hardlink circular list insertion performance

Based on https://dev.yorhel.nl/ncdu/bug/124
This commit is contained in:
Yorhel 2018-12-01 07:53:48 +01:00
parent d95c65b032
commit bf8068b65e

View file

@ -67,10 +67,8 @@ static void hlink_check(struct dir *d) {
/* found in the table? update hlnk */
if(!i) {
t = d->hlnk = kh_key(links, k);
if(t->hlnk != NULL)
for(t=t->hlnk; t->hlnk!=d->hlnk; t=t->hlnk)
;
t = kh_key(links, k);
d->hlnk = t->hlnk == NULL ? t : t->hlnk;
t->hlnk = d;
}