Rename use of `PaUtil_AllocateMemory` to `PaUtil_AllocateZeroInitializedMemory` in non-conforming examples (that should not be using these internal utility functions in the first place).

This commit is contained in:
Ross Bencina 2022-08-02 12:48:08 +10:00
parent 5c2df63010
commit 06bc8763e7
2 changed files with 4 additions and 4 deletions

View File

@ -367,7 +367,7 @@ OceanWave* InitializeWave(double SR, float attackInSeconds, float maxLevel, floa
static unsigned lastNoOfRows = 12;
unsigned newNoOfRows;
wave = (OceanWave*)PaUtil_AllocateMemory(sizeof(OceanWave));
wave = (OceanWave*)PaUtil_AllocateZeroInitializedMemory(sizeof(OceanWave));
if (wave != NULL)
{
InitializePinkNoise(&wave->wave_left, lastNoOfRows);
@ -407,14 +407,14 @@ int main(void)
static const int FPB = 128; /* Frames per buffer: 2.9 ms buffers. */
/* Initialize communication buffers (queues) */
data.rBufToRTData = PaUtil_AllocateMemory(sizeof(OceanWave*) * 256);
data.rBufToRTData = PaUtil_AllocateZeroInitializedMemory(sizeof(OceanWave*) * 256);
if (data.rBufToRTData == NULL)
{
return 1;
}
PaUtil_InitializeRingBuffer(&data.rBufToRT, sizeof(OceanWave*), 256, data.rBufToRTData);
data.rBufFromRTData = PaUtil_AllocateMemory(sizeof(OceanWave*) * 256);
data.rBufFromRTData = PaUtil_AllocateZeroInitializedMemory(sizeof(OceanWave*) * 256);
if (data.rBufFromRTData == NULL)
{
return 1;

View File

@ -315,7 +315,7 @@ int main(void)
/* We set the ring buffer size to about 500 ms */
numSamples = NextPowerOf2((unsigned)(SAMPLE_RATE * 0.5 * NUM_CHANNELS));
numBytes = numSamples * sizeof(SAMPLE);
data.ringBufferData = (SAMPLE *) PaUtil_AllocateMemory( numBytes );
data.ringBufferData = (SAMPLE *) PaUtil_AllocateZeroInitializedMemory( numBytes );
if( data.ringBufferData == NULL )
{
printf("Could not allocate ring buffer data.\n");