diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-12-11 22:22:54 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-12-16 06:22:19 +0200 |
commit | b4c2cd422ee0b68dca1902c18c3c04f94603333f (patch) | |
tree | 25e5c31914c66f051bbe8a3362c40e3422530d89 /libmpdemux | |
parent | 68c262c6c4c0addae61e78403d75f445b19f2e6a (diff) |
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
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_ts.c | 9 |
1 files 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; i<NB_PID_MAX; i++) { if(priv->ts.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; |