Page MenuHome

Simplify code in defvert_remove_group() to use realloc
Needs ReviewPublic

Authored by Chad Fraleigh (chadf) on Aug 6 2015, 8:52 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Currently the code in defvert_remove_group() does a malloc and memcpy where a realloc could be used instead. Since the allocation is always smaller, it can be resized in-place and never need to call an internal memcpy (if MEM_reallocN()'s implementation was to do this in the future). Also added an assert to make sure that the existing array is never null, instead of seeming optional as is. If it is null, the [re]allocated elements would contain garbage.

Diff Detail

Repository
rB Blender

Event Timeline

Chad Fraleigh (chadf) retitled this revision from to Simplify code in defvert_remove_group() to use realloc.
Chad Fraleigh (chadf) updated this object.
Chad Fraleigh (chadf) set the repository for this revision to rB Blender.