diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/mball_tessellate.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c index 080a8cead7b..e8418e876bb 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.c +++ b/source/blender/blenkernel/intern/mball_tessellate.c @@ -1233,14 +1233,9 @@ static void init_meta(EvaluationContext *eval_ctx, PROCESS *process, Scene *scen copy_v3_v3(new_ml->bb->vec[6], tempmax); /* add new_ml to mainb[] */ - if (process->totelem == process->mem) { - MetaElem **newelem; + if (UNLIKELY(process->totelem == process->mem)) { process->mem = process->mem * 2 + 10; - newelem = MEM_mallocN(sizeof(MetaElem *) * process->mem, "metaballs"); - - memcpy(newelem, process->mainb, sizeof(MetaElem *) * process->totelem); - if (process->mainb) MEM_freeN(process->mainb); - process->mainb = newelem; + process->mainb = MEM_reallocN(process->mainb, sizeof(MetaElem *) * process->mem); } process->mainb[process->totelem++] = new_ml; } |