[PATCH] mostly clang warnings

Jeremy Allison jra at samba.org
Tue Oct 18 18:18:48 UTC 2016


On Tue, Oct 18, 2016 at 06:12:25PM +0200, Andreas Schneider wrote:
> On Tuesday, 18 October 2016 16:25:26 CEST Volker Lendecke wrote:
> 
> Hi Volker,
> 
> the patchset looks fine for me.
> 
> > -       if (h1.data) {
> > +       if (h1.data[0] || h1.data[1]) {
> 
> I prefer to write:
> 
> if (h1.data[0] != '\0' || h1.data[1] != '\0') {
>   ...
> }
> 
> When reading the code the it makes it more clear what we are checking for.
> 
> I'm fine if you push it as is, but would prefer it the way I did it above.

Actually that's not correct Andreas.

h1 (and others) here are:

struct smb2_handle {
        uint64_t data[2];
};

so that should not be '\0', but 0.

So in this case the original code is superior (and
also pretty clear IMHO).

Jeremy.



More information about the samba-technical mailing list