bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: htags generates incorrect anchor when -s option is specified.


From: Shigio YAMAGUCHI
Subject: Re: htags generates incorrect anchor when -s option is specified.
Date: Mon, 29 May 2017 13:58:18 +0900

Hi,
Could you please send information to do a reproduction test?
o Which version of FreeBSD?
o What is the htags's command line? 
o Where is the incorrect anchor link?

Thank you in advance.

Regards,
Shigio


2017-05-28 22:37 GMT+09:00 Shuichi KITAGUCHI <address@hidden>:
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



--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: 
26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB

reply via email to

[Prev in Thread] Current Thread [Next in Thread]