changeset 29887:195deae202cb

Merge malloc+memset -> calloc
author reimar
date Tue, 17 Nov 2009 19:14:42 +0000
parents 988c42cb595a
children 5c39c41f38e8
files stream/stream.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream.c	Tue Nov 17 18:30:33 2009 +0000
+++ b/stream/stream.c	Tue Nov 17 19:14:42 2009 +0000
@@ -396,8 +396,7 @@
 
   if(len < 0)
     return NULL;
-  s=malloc(sizeof(stream_t)+len);
-  memset(s,0,sizeof(stream_t));
+  s=calloc(1, sizeof(stream_t)+len);
   s->fd=-1;
   s->type=STREAMTYPE_MEMORY;
   s->buf_pos=0; s->buf_len=len;
@@ -409,9 +408,8 @@
 }
 
 stream_t* new_stream(int fd,int type){
-  stream_t *s=malloc(sizeof(stream_t));
+  stream_t *s=calloc(1, sizeof(stream_t));
   if(s==NULL) return NULL;
-  memset(s,0,sizeof(stream_t));
 
 #if HAVE_WINSOCK2_H
   {