[pulseaudio-discuss] [PATCH 1/2] Properly initialise m->n_waiting_for_accept to prevent deadlock

Colin Guthrie gmane at colin.guthr.ie
Tue Jan 5 04:00:16 PST 2010

'Twas brillig, and Colin Guthrie at 05/01/10 09:51 did gyre and gimble:
> Would it be generally cleaner to just allocate the "m" struct with
> pa_xnew0() rather than pa_xnew()? That way neither n_waiting nor
> n_waiting_for_accept need to be explicitly set.

Incidentally this wasn't meant to be nit picking! Just a genuine
question as to what the preferred approach is!

The two approaches have pro/cons. pa_xnew0 could be considered to be
doing more than it needs to in some circumstances but is safer for
future expansion. Setting the values explicitly is nice and
clear/readable but can lead to forgetting to set things explicitly



Colin Guthrie

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

More information about the pulseaudio-discuss mailing list