[PATCH] ccan: Fix calling memset with zero length parameter.

Andreas Schneider asn at samba.org
Thu Jul 11 07:04:47 MDT 2013


On Thursday 11 July 2013 14:59:15 Volker Lendecke wrote:
> On Thu, Jul 11, 2013 at 02:04:00PM +0200, Andreas Schneider wrote:
> >   2381                   from ../lib/ccan/likely/likely.h:5,
> >   2382                   from ../lib/ccan/tally/tally.c:4:
> >   2383  In function 'memset',
> >   2384      inlined from 'tally_histogram' at
> >   ../lib/ccan/tally/tally.c:513:9: 2385 
> >   /usr/include/bits/string3.h:81:30: warning: call to
> > 
> > '__warn_memset_zero_len' declared with attribute warning: memset used with
> > constant zero length parameter; this could be due to transposed parameters
> > [enabled by default]
> > 
> >   2386         __warn_memset_zero_len ();
> >   2387                                ^
> > 
> > I didn't see how could could be always 0 here but probably count = 0 is
> > what the compiler sees and warns about.
> 
> To avoid an additional if-statement, what about the
> alternative attached patch?

Pushed :)


-- 
Andreas Schneider                   GPG-ID: F33E3FC6
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list