Mercurial > mplayer.hg
changeset 28817:c64464d924d5
Use calloc instead of malloc+memset
author | reimar |
---|---|
date | Fri, 06 Mar 2009 16:27:31 +0000 |
parents | 6e5b9867646c |
children | e3d54ef875a5 |
files | libao2/ao_win32.c |
diffstat | 1 files changed, 1 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libao2/ao_win32.c Fri Mar 06 15:52:48 2009 +0000 +++ b/libao2/ao_win32.c Fri Mar 06 16:27:31 2009 +0000 @@ -146,7 +146,6 @@ static int init(int rate,int channels,int format,int flags) { WAVEFORMATEXTENSIBLE wformat; - DWORD totalBufferSize = (BUFFER_SIZE + sizeof(WAVEHDR)) * BUFFER_COUNT; MMRESULT result; unsigned char* buffer; int i; @@ -231,8 +230,7 @@ return 0; } //allocate buffer memory as one big block - buffer = malloc(totalBufferSize); - memset(buffer,0x0,totalBufferSize); + buffer = calloc(BUFFER_COUNT, BUFFER_SIZE + sizeof(WAVEHDR)); //and setup pointers to each buffer waveBlocks = (WAVEHDR*)buffer; buffer += sizeof(WAVEHDR) * BUFFER_COUNT;