[PATCH] s3: Remove check of constant condition in loop

Jeremy Allison jra at samba.org
Tue Mar 6 23:10:01 UTC 2018


On Wed, Mar 07, 2018 at 12:05:03AM +0100, Timur I. Bakeyev via samba-technical wrote:
> Hi, Swen!
> 
> On 6 March 2018 at 11:46, Swen Schillig via samba-technical <
> samba-technical at lists.samba.org> wrote:
> 
> > Please review ...and push.
> >
> 
> Not sure which compiler did you use for testing, but Clang isn't happy with
> nested function declaration:

Yeah, I think it's a gcc-ism.

> +	bool (*str_eq)(const char *, const char *) = NULL;
> +	bool strequal_cs(const char *s1, const char *s2)
> +		{ return (strcmp(s1, s2) == 0); }
> +
> +	str_eq = (conn->case_sensitive) ? strequal_cs : strequal;
> 
> 
> And just refuses to compile. I had to move strequal_cs() outside the
> function and declare it static:
> 
> + static bool strequal_cs(const char *s1, const char *s2)
> + {
> +         return (strcmp(s1, s2) == 0);
> + }
> 
> Please, consider such a change.

+1 - this can't go in as-is, as we need to be portable to
more than just gcc.

Jeremy.



More information about the samba-technical mailing list