Re: [PATCH] wip: change ISSPACE to use ascii whitespace check.

Gero Treuner <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <[email protected]>
Hi,

On Thu, Feb 19, 2026 at 01:57:11AM +0100, Alejandro Colomar via Mutt-dev wrote:
> > > Here's a naive definition:
> > > 
> > > 	char *
> > > 	strchrnul(const char *s, int c)
> > > 	{
> > > 		char  *p;
> > > 
> > > 		p = strchr(s, c);
> > > 		if (p == NULL)
> > > 			return (char *) s + strlen(s);
> > > 		return p;
> > 
> > This can be compacted into a one-liner:
> > 
> > 		return strchr(s, c) ?: (char *) s + strlen(s);
> 
> And avoiding the cast:
> 
> 	#define strnul(s)  strchr(s, '\0')
> 
> 	char *
> 	strchrnul(const char *s, int c)
> 	{
> 		return strchr(s, c) ?: strnul(s);
> 	}

On compiler level this replaces a function with 1 argument by
another with 2 (although functionally equivalent).

Personally I don't have an issue with casts. But I do care about the
footprint on the end users system (even if the difference is small).

> > All compilers that I know, support '?:'.  It will be discussed for
> > standardization next month.

What about adding a compiler test suite in the next release to
evaluate environments used to compile mutt in the wild? Output could be
a deprecation warning for subsequent mutt releases and asking
for contacting this list if people really think that their setups
should remain supported. This to prevent reversing patches if final
consideration for an optimization might be breaking too much.


Kind regards
   Gero
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.