Hi Kevin,

On 2026-02-24T21:05:51+0800, Kevin J. McCarthy wrote:
> On Tue, Feb 24, 2026 at 01:41:26PM +0100, Rene Kita wrote:
> > On Tue, Feb 24, 2026 at 07:23:26PM +0800, Kevin J. McCarthy wrote:
> > 
> > This explains why it went so smooth with Arch. m-(
> > 
> > Running the build on Arch I get multiple errors of this kind:
> > browser.c:548:17: error: initialization discards 'const' qualifier from
> > pointer target type [-Werror=discarded-qualifiers]
> >  548 |       char *c = strrchr (d, '/');
> >      |                 ^~~~~~~
> > 
> > This is in function:
> > static int examine_directory (MUTTMENU *menu, struct browser_state *state,
> >                           const char *d, const char *prefix).
> > 
> > AFAIU, strrchr is defined as: char * strrchr(const char *s, int c).
> > 
> > *c is changed later in that function, so we can't make it const. Any
> > ideas what's the best way forward from here?
> 
> Ah, that was my mistake from 7 years ago!  I changed the parameter type when
> I was converting to buffers and the compiler didn't flag anything, so I
> failed to notice d was sneakily being modified.

Indeed; I find working with bare strings much easier.  Buffers seem
safer in theory, but end up having corner cases that are uglier than
strings themselves.

> The "d" parameters buffers all come from the pool, so they won't be NULL.  I
> think the best thing to do is change the parameter type back to char *d and
> just directly pass the parameter->data.  But let me take a closer look
> tomorrow and fix it up.

See the other emails I've sent; they might help.


Have a lovely day!
Alex

> 
> -- 
> Kevin J. McCarthy
> GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA



-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to