summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno George Moraes <brunogm0@gmail.com>2014-09-26 11:00:40 -0300
committerwm4 <wm4@nowhere>2014-09-27 16:01:49 +0200
commitacf6aef882eae08d87e353e7c6b33a179f4dea78 (patch)
treec7ddc80da11f8edd98b61dcdcb9dc4d807c176a3
parent650af294716e34a3992770aab23aafebb358bac8 (diff)
downloadmpv-acf6aef882eae08d87e353e7c6b33a179f4dea78.tar.bz2
mpv-acf6aef882eae08d87e353e7c6b33a179f4dea78.tar.xz
stream: change malloc+memset to calloc
Also removed some memset that were left on some calloc that was already in the code. Signed-off-by: wm4 <wm4@nowhere>
-rw-r--r--stream/stream.c4
-rw-r--r--stream/stream_cdda.c3
-rw-r--r--stream/tvi_v4l2.c3
3 files changed, 2 insertions, 8 deletions
diff --git a/stream/stream.c b/stream/stream.c
index f551fd89b5..c664173f4e 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -238,9 +238,7 @@ static bool parse_url(struct stream *st, struct m_config *config)
static stream_t *new_stream(void)
{
- stream_t *s = talloc_size(NULL, sizeof(stream_t) + TOTAL_BUFFER_SIZE);
- memset(s, 0, sizeof(stream_t));
- return s;
+ return talloc_zero_size(NULL, sizeof(stream_t) + TOTAL_BUFFER_SIZE);
}
static const char *match_proto(const char *url, const char *proto)
diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c
index d105141200..37a3aab1c5 100644
--- a/stream/stream_cdda.c
+++ b/stream/stream_cdda.c
@@ -314,8 +314,7 @@ static int open_cdda(stream_t *st)
return STREAM_ERROR;
}
- priv = malloc(sizeof(cdda_priv));
- memset(priv, 0, sizeof(cdda_priv));
+ priv = calloc(1,sizeof(cdda_priv));
priv->cd = cdd;
if (p->toc_bias)
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index f2ec84d4cf..f339b83439 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -1350,8 +1350,6 @@ static int start(priv_t *priv)
MP_ERR(priv, "cannot allocate video buffer: %s\n", strerror(errno));
return 0;
}
- memset(priv->video_ringbuffer,0,priv->video_buffer_size_max * sizeof(video_buffer_entry));
-
pthread_mutex_init(&priv->video_buffer_mutex, NULL);
priv->video_head = 0;
@@ -1382,7 +1380,6 @@ static int start(priv_t *priv)
/* map and queue buffers */
for (i = 0; i < request.count; i++) {
- memset(&priv->map[i].buf,0,sizeof(priv->map[i].buf));
priv->map[i].buf.index = i;
priv->map[i].buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
priv->map[i].buf.memory = V4L2_MEMORY_MMAP;