Use calloc instead of malloc+memset

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28852 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2009-03-06 16:27:31 +00:00
parent 1b1bc049db
commit 79df4b2499
1 changed files with 1 additions and 3 deletions

View File

@ -146,7 +146,6 @@ static int control(int cmd,void *arg)
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 @@ static int init(int rate,int channels,int format,int flags)
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;