Re: [PATCH] Fix const warnings on Arch linux with the latest glibc.

Alejandro Colomar via Mutt-dev <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <aZ7XCOSDO6cZGfR9@devuan>
Hi Kevin,

On 2026-02-25T17:57:24+0800, Kevin J. McCarthy wrote:
> The latest version changes string search functions, such as strchr()
> and strrchr(), so that the return type is the same type as the string
> passed in.
> 
> This helped us catch a real bug in browser.c (3a8dfafc), and also
> turned up some variable type issues, fixed here.

Nice!

> 
> Thanks to Rene Kita for the work on the Arch sr.ht build files which
> turned up the bugs, and for an initial patch showing where the warning
> were, which this commit is based upon.
> 
> Also thanks to Alejandro Colomar for quickly explaining what was going
> on and helping debug the issues.

You're welcome!  :-)

> ---
>  mh.c      |  6 ++++--
>  muttlib.c |  3 ++-
>  parse.c   |  5 +++--
>  rfc1524.c |  7 ++++---
>  sendlib.c |  3 ++-
>  url.c     | 10 ++++++----
>  6 files changed, 21 insertions(+), 13 deletions(-)
> 
[...]

Most changes look good.

> diff --git a/parse.c b/parse.c
> index 141947f4..c46a5811 100644
> --- a/parse.c
> +++ b/parse.c
[...]
> @@ -1001,7 +1001,8 @@ time_t mutt_parse_date (const char *s, HEADER *h)
>          {
>            struct tz_t *tz;
>  
> -          tz = bsearch (ptz, TimeZones, sizeof TimeZones/sizeof (struct tz_t),
> +          tz = (struct tz_t *)bsearch (ptz, TimeZones,
> +                        sizeof TimeZones/sizeof (struct tz_t),
>                          sizeof (struct tz_t),
>                          (int (*)(const void *, const void *)) ascii_strcasecmp
>                          /* This is safe to do: A pointer to a struct equals

But, why do we need to cast here?

[...]


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmme19cACgkQ64mZXMKQ
wqnmyRAAuPeuJLNMqBkmMKMC5N29hrHp6TGucsYccEOrhYv4YAb3n6DP2yGmfGfW
7MtRAiZk2vjRmGvc9gX2xQv0fuIuW/1R+Pfj7XlUZ2dfqeDXsRwVph6rTKU8ALss
J2Fw/fMTB2CXrKNAQsyObd/aSQ6JGdMfLWwWLz9DZP+gxRpIo7BM6XzTVJd4tmX3
94LfAsMOsD0zyz1t+X4Yk/37rXTNO3JQlNIjSZz2ugV1a5F8g7k+Ys9YTL9ti+bC
pNVIe7YotpG+3yd08dnRSDxqFp5q2Bn5qujRhp6LzMXSAQhpNlJKGpmhPMw96+rl
NaOY0Nytmq/QAryIj0nsENtpH6hRFdBVLwwFXibbYjQn9PVjbj1QiFQbpvhPj4G9
aXNzxd8afg7XnXxe7YCNBtmbQRgr8qvXeBg1eF/jh0Xg8FoUBKKCkm7C7LD4MUAD
tSsKsp6tAcpuOp6kcIU3vFy8gd5G4kiqLUxgbwFFRRXNMneLpeFdUUYXd4g8nTK6
Zui1s0PMa5ywSCXKubs/A51UdihUsfjFqrQhM4HWtYjiKT54gN/lkVDGGiy04wli
dQ4J5lqCZvD+Fwuo14OTkA1BfvF2HEMgkx8XS/vHd6vqaciBfWd5ExParT4pvTge
EPeJRq3thSs//4A47NNXNUSZCWdJrN+Y0VPgCFsfhbr1qHvBiKk=
=+Cet
-----END PGP SIGNATURE-----
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.