[PATCH weston 01/12] shared: Add timespec_is_zero helper

Alexandros Frantzis alexandros.frantzis at collabora.com
Mon Nov 27 08:58:33 UTC 2017


On Mon, Nov 27, 2017 at 10:20:35AM +0200, Pekka Paalanen wrote:
> On Fri, 24 Nov 2017 18:36:43 +0000
> Emil Velikov <emil.l.velikov at gmail.com> wrote:
> 
> > Hi Alexandros,
> > 
> > On 16 November 2017 at 16:20, Alexandros Frantzis
> > <alexandros.frantzis at collabora.com> wrote:
> > 
> > > +ZUC_TEST(timespec_test, timespec_is_zero)
> > > +{
> > > +       struct timespec zero = { 0 };
> > > +       struct timespec non_zero_sec = { 1, 0 };
> > > +       struct timespec non_zero_nsec = { 0, 1 };
> > > +  
> > The standard (be that POSIX or C99) does not guarantee the layout of
> > the struct. Hence the above approach may work, but it's a bad idea.
> > Personally I'm a fan of C99 designated initializers, although one
> > could set the tv_sec and tv_nsec individually.
> > 
> > Same comment applies through the rest of the series.
> 
> That's actually a very good point, I missed it!
> 
> Alexandros, can you revise, please?
> 
> Thanks,
> pq

Hi Pekka and Emil,

I have sent v2 for the 01/12 patch with the fix. I checked the rest of
the patches and this is the only point the struct members are
initialized without using the member names.

Thank you,
Alexandros


More information about the wayland-devel mailing list