[vlc-commits] lib/media_player: libvlc_get_track_description: simplify allocations
Filip Roséen
git at videolan.org
Fri Mar 17 09:08:35 CET 2017
vlc | branch: master | Filip Roséen <filip at atch.se> | Wed Mar 15 10:09:56 2017 +0100| [37205f4443d4daaa74e5b617aa1f54a1151f37fd] | committer: Thomas Guillem
lib/media_player: libvlc_get_track_description: simplify allocations
There is no need for the explicit cast, nor do we need to state the
name of the object's type for which we are allocating memory. These
changes should make it easier to read, and maintain, the function.
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=37205f4443d4daaa74e5b617aa1f54a1151f37fd
---
lib/media_player.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/media_player.c b/lib/media_player.c
index 0487cc8..a0ef780 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1788,8 +1788,7 @@ libvlc_track_description_t *
if( val_list.p_list->i_count <= 0 )
goto end;
- p_track_description = ( libvlc_track_description_t * )
- malloc( sizeof( libvlc_track_description_t ) );
+ p_track_description = malloc( sizeof *p_track_description );
if ( !p_track_description )
{
libvlc_printerr( "Not enough memory" );
@@ -1801,8 +1800,7 @@ libvlc_track_description_t *
{
if( !p_actual )
{
- p_actual = ( libvlc_track_description_t * )
- malloc( sizeof( libvlc_track_description_t ) );
+ p_actual = malloc( sizeof *p_actual );
if ( !p_actual )
{
libvlc_track_description_list_release( p_track_description );
More information about the vlc-commits
mailing list