From b4c2cd422ee0b68dca1902c18c3c04f94603333f Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 11 Dec 2010 22:22:54 +0000 Subject: demux_ts: cleanup Replace malloc+memset with calloc and use sizeof(*variable). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32694 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace hard-coded number for loop limits for array index by the define used in the array declaration. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32695 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_ts.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c index cd2441314e..a68b59396b 100644 --- a/libmpdemux/demux_ts.c +++ b/libmpdemux/demux_ts.c @@ -927,7 +927,7 @@ static off_t ts_detect_streams(demuxer_t *demuxer, tsdemux_init_t *param) mp_msg(MSGT_DEMUXER, MSGL_INFO, "\n"); - for(i=0; i<8192; i++) + for(i=0; its.pids[i] != NULL) { @@ -994,7 +994,7 @@ static demuxer_t *demux_open_ts(demuxer_t * demuxer) return NULL; } - for(i=0; i < 8192; i++) + for(i=0; i < NB_PID_MAX; i++) { priv->ts.pids[i] = NULL; priv->ts.streams[i].id = -3; @@ -2186,10 +2186,9 @@ static ES_stream_t *new_pid(ts_priv_t *priv, int pid) { ES_stream_t *tss; - tss = malloc(sizeof(ES_stream_t)); + tss = calloc(sizeof(*tss), 1); if(! tss) return NULL; - memset(tss, 0, sizeof(ES_stream_t)); tss->pid = pid; tss->last_cc = -1; tss->type = UNKNOWN; @@ -3263,7 +3262,7 @@ static void demux_seek_ts(demuxer_t *demuxer, float rel_seek_secs, float audio_d newpos = demuxer->movi_start; //begininng of stream stream_seek(demuxer->stream, newpos); - for(i = 0; i < 8192; i++) + for(i = 0; i < NB_PID_MAX; i++) if(priv->ts.pids[i] != NULL) priv->ts.pids[i]->is_synced = 0; -- cgit v1.2.3