[vlc-devel] [vlc-commits] commit: stats: fix initialization on 32bits builds ( Rafaël Carré )

Rafaël Carré rafael.carre at gmail.com
Tue Nov 2 10:11:47 CET 2010


On Tue, 2 Nov 2010 10:00:13 +0100
Laurent Aimar <fenrir at elivagar.org> wrote:

> yn Tue, Nov 02, 2010 at 07:16:03AM +0100, git at videolan.org wrote:
> > vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Tue
> > Nov  2 07:15:00 2010 +0100|
> > [03c9cf61730535306dfb6d6b6b8ec473c8c7adb0] | committer: Rafaël
> > Carré 
> > 
> > stats: fix initialization on 32bits builds
> > 
> > using psz_string to initialize will leave the top 32bits
> > uninitialized
> > -            p_new->value.psz_string = NULL;
> > +            p_new->value.i_int = 0;
>  Wouldn't memset(&p_new->value, 0, sizeof(p_new->value)) be safer
> then?

Yes but since i_int is 64 bits and is also the biggest element in the
union, setting i_int will work fine until we add a >64bits element in
the union.

If you prefer we could use memset instead, but I prefer if it we have
an helper for this, e.g. var_Init()

-- 
✍ Rafaël Carré ☺
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20101102/d69752d7/attachment.sig>


More information about the vlc-devel mailing list