changeset 32636:146fb0958630

Replace two malloc+memset with calloc.
author cboesch
date Sun, 19 Dec 2010 14:19:04 +0000
parents b05c02525cb1
children 9d2f9a281c62
files stream/http.c stream/url.c
diffstat 2 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/stream/http.c	Sun Dec 19 14:15:44 2010 +0000
+++ b/stream/http.c	Sun Dec 19 14:19:04 2010 +0000
@@ -298,9 +298,8 @@
 http_new_header(void) {
 	HTTP_header_t *http_hdr;
 
-	http_hdr = malloc(sizeof(HTTP_header_t));
+	http_hdr = calloc(1, sizeof(*http_hdr));
 	if( http_hdr==NULL ) return NULL;
-	memset( http_hdr, 0, sizeof(HTTP_header_t) );
 
 	return http_hdr;
 }
--- a/stream/url.c	Sun Dec 19 14:15:44 2010 +0000
+++ b/stream/url.c	Sun Dec 19 14:19:04 2010 +0000
@@ -102,15 +102,12 @@
         }
 
 	// Create the URL container
-	Curl = malloc(sizeof(URL_t));
+	Curl = calloc(1, sizeof(*Curl));
 	if( Curl==NULL ) {
 		mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
 		goto err_out;
 	}
 
-	// Initialisation of the URL container members
-	memset( Curl, 0, sizeof(URL_t) );
-
 	url_escape_string(escfilename,url);
 
 	// Copy the url in the URL container