1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-21 01:24:21 +00:00

New class HeapBlock, which provides a safe and object-oriented way to allocate heap space. I've used HeapBlocks to replace almost all uses of malloc/free throughout the codebase.

This commit is contained in:
Julian Storer 2010-01-02 14:55:44 +00:00
parent 8c988319ec
commit 4ed1d791e5
86 changed files with 22712 additions and 22630 deletions

View file

@ -621,7 +621,7 @@ public:
if (numParameters > 0)
{
NPVariant* const params = (NPVariant*) juce_malloc (sizeof (NPVariant) * numParameters);
HeapBlock <NPVariant> params (numParameters);
int i;
for (i = 0; i < numParameters; ++i)
@ -636,8 +636,6 @@ public:
for (i = 0; i < numParameters; ++i)
browser.releasevariantvalue (&params[i]);
juce_free (params);
}
else
{
@ -688,7 +686,9 @@ private:
if (o == 0 || ! o->hasMethod (methodName))
return false;
var* params = (var*) juce_calloc (sizeof (var) * argCount);
HeapBlock <var> params;
params.calloc (argCount);
for (uint32_t i = 0; i < argCount; ++i)
params[i] = createValueFromNPVariant (npp, args[i]);
@ -697,8 +697,6 @@ private:
for (int i = argCount; --i >= 0;)
params[i] = var();
juce_free (params);
if (out != 0)
createNPVariantFromValue (npp, *out, result);