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

Shigio YAMAGUCHI <[email protected]>
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <CADJmJYqfa2gTUoX-eR=5Pv-HLhXFhgG0Sown4E_xYkrDhtjU8g@mail.gmail.com>
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 <[email protected]>:

> 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
> [email protected]
> https://lists.gnu.org/mailman/listinfo/bug-global
>



-- 
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB

_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.