On Wed, Feb 25, 2026 at 01:13:53PM +0100, Alejandro Colomar via Mutt-dev wrote:
> Hi Kevin,
> 
> On 2026-02-25T20:03:33+0800, Kevin J. McCarthy wrote:
> > On Wed, Feb 25, 2026 at 12:07:03PM +0100, Alejandro Colomar wrote:
> > > > 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?
> > 
> > Oh, for this one I'm not sure.  It was in the patch Rene sent out initially,
> 
> Ahh, that was just to mark the places that needed inspection, IIRC, not
> to actually use those casts.

Correct. I did this while being ssh'ed into the CI VM. I just cast and
keep -Werror to not miss any warnings.

> bsearch(3) is one of the functions that now preserve const.
> 
> > so I just included it.  Rene, can you confirm the need for the cast?
> 
> I've now checked the code, and we don't write to it, so the solution
> would be to declare 'tz' to be const, I think.
> 
>       -struct tz_t *tz;
>       +const struct tz_t *tz;

I can confirm that this builds without warnings.

Reply via email to