[PATCH] Remove needless memsets after calloc

Michael McConville <[email protected]>
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
Hi guys.

Unless, I’m missing something obvious, this is pretty self-explanatory. Calloc zeroes memory, so there’s no need to re-zero it, and modern compilers often miss this optimization.

Thanks for your time,
Michael McConville
University of Utah

Index: libmpdemux/muxer_avi.c
===================================================================
--- libmpdemux/muxer_avi.c	(revision 38012)
+++ libmpdemux/muxer_avi.c	(working copy)
@@ -120,7 +120,6 @@
     si->idx=calloc(si->idxsize, sizeof(struct avi_odmlidx_entry));
     si->riffofssize=16;
     si->riffofs=calloc((si->riffofssize+1), sizeof(off_t));
-    memset(si->riffofs, 0, sizeof(off_t)*si->riffofssize);
 
     switch(type){
     case MUXER_TYPE_VIDEO:
@@ -619,7 +618,6 @@
 
     si->superidxsize = si->superidxpos;
     si->superidx = calloc(si->superidxsize, sizeof(*si->superidx));
-    memset(si->superidx, 0, sizeof(*si->superidx) * si->superidxsize);
 
     idxpos = 0;
     for (j=0; j<si->superidxpos; j++) {
_______________________________________________
MPlayer-dev-eng mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.