[MPlayer-cvslog] r32723 - in trunk/stream: http.c url.c

cboesch subversion at mplayerhq.hu
Sun Dec 19 15:19:04 CET 2010


Author: cboesch
Date: Sun Dec 19 15:19:04 2010
New Revision: 32723

Log:
Replace two malloc+memset with calloc.

Modified:
   trunk/stream/http.c
   trunk/stream/url.c

Modified: trunk/stream/http.c
==============================================================================
--- trunk/stream/http.c	Sun Dec 19 15:15:44 2010	(r32722)
+++ trunk/stream/http.c	Sun Dec 19 15:19:04 2010	(r32723)
@@ -298,9 +298,8 @@ HTTP_header_t *
 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;
 }

Modified: trunk/stream/url.c
==============================================================================
--- trunk/stream/url.c	Sun Dec 19 15:15:44 2010	(r32722)
+++ trunk/stream/url.c	Sun Dec 19 15:19:04 2010	(r32723)
@@ -102,15 +102,12 @@ url_new(const char* url) {
         }
 
 	// 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


More information about the MPlayer-cvslog mailing list