[Bf-blender-cvs] [e7f1de5e110] master: Cleanup: use MEM_recallocN_id utility function

Campbell Barton noreply at git.blender.org
Wed Mar 4 13:52:18 CET 2020


Commit: e7f1de5e110a925cfa11bb7824c4fe2695e274ba
Author: Campbell Barton
Date:   Wed Mar 4 23:51:32 2020 +1100
Branches: master
https://developer.blender.org/rBe7f1de5e110a925cfa11bb7824c4fe2695e274ba

Cleanup: use MEM_recallocN_id utility function

===================================================================

M	source/blender/makesrna/intern/rna_define.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index aed2c94b493..55c97672958 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -4334,18 +4334,14 @@ int rna_parameter_size(PropertyRNA *parm)
 
 void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
 {
-  EnumPropertyItem *newitems;
   int tot = *totitem;
 
   if (tot == 0) {
-    *items = MEM_callocN(sizeof(EnumPropertyItem) * 8, "RNA_enum_items_add");
+    *items = MEM_callocN(sizeof(EnumPropertyItem) * 8, __func__);
   }
   else if (tot >= 8 && (tot & (tot - 1)) == 0) {
     /* power of two > 8 */
-    newitems = MEM_callocN(sizeof(EnumPropertyItem) * tot * 2, "RNA_enum_items_add");
-    memcpy(newitems, *items, sizeof(EnumPropertyItem) * tot);
-    MEM_freeN(*items);
-    *items = newitems;
+    *items = MEM_recallocN_id(*items, sizeof(EnumPropertyItem) * tot * 2, __func__);
   }
 
   (*items)[tot] = *item;



More information about the Bf-blender-cvs mailing list