[vlc-devel] [vlc-commits] dbus: allocate pollfd array on the stack
Rémi Denis-Courmont
remi at remlab.net
Mon Aug 8 08:30:48 CEST 2011
On Mon, 8 Aug 2011 02:08:43 +0200 (CEST), git at videolan.org (Rafaël Carré)
wrote:
> int i_watches = vlc_array_count( p_sys->p_watches );
> - struct pollfd *p_fds = calloc( i_watches, sizeof( struct pollfd
)
> );
> + struct pollfd fds[i_watches];
> + memset(fds, 0, sizeof fds);
Contrary to popular belief, pollfd do not need to be memset(). poll() only
reads the fd and events fields, which will not normally be zero, and writes
the revents field.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list