changeset 32331:3661c193c3ba

Use calloc instead of malloc and memset. Patch by Clment Bsch, ubitux gmail
author cehoyos
date Thu, 30 Sep 2010 09:10:35 +0000
parents acbe908638b2
children 7f082ae61e1c
files subreader.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/subreader.c	Thu Sep 30 09:08:37 2010 +0000
+++ b/subreader.c	Thu Sep 30 09:10:35 2010 +0000
@@ -1925,8 +1925,7 @@
 
     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 @@
 
     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;