changeset 20072:3f63d6e12a1a

Simplify: replace malloc + memset 0 by calloc
author reimar
date Thu, 05 Oct 2006 21:31:21 +0000
parents 672123d27ae3
children 4b6fbec79777
files libmpdemux/demuxer.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Thu Oct 05 21:28:55 2006 +0000
+++ b/libmpdemux/demuxer.c	Thu Oct 05 21:31:21 2006 +0000
@@ -213,8 +213,7 @@
     } else {
         sh_audio_t *sh;
         mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_FoundAudioStream,id);
-        demuxer->a_streams[id]=malloc(sizeof(sh_audio_t));
-        memset(demuxer->a_streams[id],0,sizeof(sh_audio_t));
+        demuxer->a_streams[id]=calloc(1, sizeof(sh_audio_t));
         sh = demuxer->a_streams[id];
         // set some defaults
         sh->samplesize=2;
@@ -246,8 +245,7 @@
         mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_VideoStreamRedefined,id);
     } else {
         mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_FoundVideoStream,id);
-        demuxer->v_streams[id]=malloc(sizeof(sh_video_t));
-        memset(demuxer->v_streams[id],0,sizeof(sh_video_t));
+        demuxer->v_streams[id]=calloc(1, sizeof(sh_video_t));
           mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ID=%d\n", vid);
     }
     ((sh_video_t *)demuxer->v_streams[id])->vid = vid;