-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
As I'm new to smart pointers and memory management in C++ I have a short
question on this topic.
I'm now using the following code to traverse the devices and their ports:
snd_seq_client_info_t *clientInfo = 0;
snd_seq_port_info_t *portInfo = 0;
snd_seq_client_info_malloc(&clientInfo);
snd_seq_port_info_malloc(&portInfo);
shared_ptr<snd_seq_client_info_t> clientInfoMemoryHandler(clientInfo,
snd_seq_client_info_free);
shared_ptr<snd_seq_port_info_t> portInfoMemoryHandler(portInfo,
snd_seq_port_info_free);
.
.
.
snd_seq_port_info_set_client( portInfo,
snd_seq_client_info_get_client(clientInfo ) );
snd_seq_port_info_set_port( portInfo, -1 );
while ( snd_seq_query_next_port( seq, portInfo ) >= 0 ) {
string portName = snd_seq_port_info_get_name( portInfo );
unsigned int capability = snd_seq_port_info_get_capability( portInfo );
.
.
.
Well the cleanUp methods are called at block-leaving.
I'm only a bit curious because after giving portInfo and clientInfo to
the shared_ptr for cleanup management I have to use them for all the
alsa queries.
But since I'm not using malloc and free in these queries everything is
ok, isn't it?
Thanks for your help!
Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkqiFXwACgkQVC26eJ+o0+3H6wCcCb49zyCeNFpyOksEpKA0uXL7
5NMAoJNXUhpWmMNWGU80RoqoqUp52dSf
=IcCV
-----END PGP SIGNATURE-----
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Sat Sep 5 12:15:02 2009
This archive was generated by hypermail 2.1.8 : Sat Sep 05 2009 - 12:15:02 EEST