Remove out-of-line uses of qMalloc/qFree/qRealloc.

Per http://codereview.qt-project.org/#change,11562,  we are trying to
remove these in favour of direct allocation,  or (in the case of inline code)
specialised out-of-line wrappers.

Change-Id: If3fb6c4851633bdbb2b2771de0180c668bb01d14
Reviewed-by: Mithra Pattison <mithra.pattison@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Robin Burchell
2012-01-06 19:31:00 +01:00
committed by Qt by Nokia
parent 0c88091bfc
commit b228ff95d7
2 changed files with 8 additions and 8 deletions

View File

@@ -218,7 +218,7 @@ QList<int> QAudioDeviceInfoInternal::supportedChannelCounts()
&propSize,
0) == noErr) {
AudioBufferList* audioBufferList = static_cast<AudioBufferList*>(qMalloc(propSize));
AudioBufferList* audioBufferList = static_cast<AudioBufferList*>(malloc(propSize));
if (audioBufferList != 0) {
if (AudioDeviceGetProperty(deviceId,
@@ -234,7 +234,7 @@ QList<int> QAudioDeviceInfoInternal::supportedChannelCounts()
}
}
qFree(audioBufferList);
free(audioBufferList);
}
}

View File

@@ -80,7 +80,7 @@ public:
dataSize = 0;
bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) +
bfs = reinterpret_cast<AudioBufferList*>(malloc(sizeof(AudioBufferList) +
(sizeof(AudioBuffer) * numberOfBuffers)));
bfs->mNumberBuffers = numberOfBuffers;
@@ -98,7 +98,7 @@ public:
{
dataSize = bufferSize;
bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) + sizeof(AudioBuffer)));
bfs = reinterpret_cast<AudioBufferList*>(malloc(sizeof(AudioBufferList) + sizeof(AudioBuffer)));
bfs->mNumberBuffers = 1;
bfs->mBuffers[0].mNumberChannels = 1;
@@ -116,13 +116,13 @@ public:
dataSize = framesToBuffer * sf.mBytesPerFrame;
bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) +
bfs = reinterpret_cast<AudioBufferList*>(malloc(sizeof(AudioBufferList) +
(sizeof(AudioBuffer) * numberOfBuffers)));
bfs->mNumberBuffers = numberOfBuffers;
for (int i = 0; i < numberOfBuffers; ++i) {
bfs->mBuffers[i].mNumberChannels = isInterleaved ? numberOfBuffers : 1;
bfs->mBuffers[i].mDataByteSize = dataSize;
bfs->mBuffers[i].mData = qMalloc(dataSize);
bfs->mBuffers[i].mData = malloc(dataSize);
}
}
@@ -130,10 +130,10 @@ public:
{
if (owner) {
for (UInt32 i = 0; i < bfs->mNumberBuffers; ++i)
qFree(bfs->mBuffers[i].mData);
free(bfs->mBuffers[i].mData);
}
qFree(bfs);
free(bfs);
}
AudioBufferList* audioBufferList() const