|
From: | Shigio YAMAGUCHI |
Subject: | Re: htags generates incorrect anchor when -s option is specified. |
Date: | Mon, 29 May 2017 13:58:18 +0900 |
Hi,
I've found that htags command generates incorrect anchor link when -s
option is specified on FreeBSD and Cygwin. Linux is ok. Upon
investigation, this seems to be caused by behaviour of qsort().
When anchor->lineno is same and cmp()@htags/anchor.c returns 0, some
qsort() impelmentation might swap objects. This causes that type 'R'
is upper than type 'T', and anchor_get() cannot find correct anchor.
If appling below patch to htags/anchor.c, htags seems generate correct
link.
static int
cmp(const void *s1, const void *s2)
{
+#if 1
+ int diff = ((struct anchor *)s1)->lineno - ((struct anchor *)s2)->lineno;
+ /* when lineno is same, preserve current order. */
+ return diff == 0 ? -1 : diff;
+#else
return ((struct anchor *)s1)->lineno - ((struct anchor *)s2)->lineno;
+#endif
}
/*
* Pointers (as lineno).
Is this right fix?
Thanks,
_______________________________________________
Bug-global mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-global
[Prev in Thread] | Current Thread | [Next in Thread] |