[MPlayer-cvslog] r32417 - trunk/subreader.c

cehoyos subversion at mplayerhq.hu
Thu Sep 30 11:10:35 CEST 2010


Author: cehoyos
Date: Thu Sep 30 11:10:35 2010
New Revision: 32417

Log:
Use calloc instead of malloc and memset.

Patch by Clément Bœsch, ubitux gmail

Modified:
   trunk/subreader.c

Modified: trunk/subreader.c
==============================================================================
--- trunk/subreader.c	Thu Sep 30 11:08:37 2010	(r32416)
+++ trunk/subreader.c	Thu Sep 30 11:10:35 2010	(r32417)
@@ -1925,8 +1925,7 @@ char** sub_filenames(const char* path, c
 
     tmpresult = malloc(len);
 
-    result = malloc(sizeof(subfn)*MAX_SUBTITLE_FILES);
-    memset(result, 0, sizeof(subfn)*MAX_SUBTITLE_FILES);
+    result = calloc(MAX_SUBTITLE_FILES, sizeof(*result));
 
     subcnt = 0;
 
@@ -2064,8 +2063,7 @@ char** sub_filenames(const char* path, c
 
     qsort(result, subcnt, sizeof(subfn), compare_sub_priority);
 
-    result2 = malloc(sizeof(char*)*(subcnt+1));
-    memset(result2, 0, sizeof(char*)*(subcnt+1));
+    result2 = calloc(subcnt + 1, sizeof(*result2));
 
     for (i = 0; i < subcnt; i++) {
 	result2[i] = result[i].fname;


More information about the MPlayer-cvslog mailing list