[Bf-blender-cvs] [c19d2f2507a] master: Cleanup: use MEM_recallocN_id

Campbell Barton noreply at git.blender.org
Fri Mar 6 02:00:57 CET 2020


Commit: c19d2f2507a45d2a6da35dbe2ff842f71c2daae0
Author: Campbell Barton
Date:   Fri Mar 6 12:00:37 2020 +1100
Branches: master
https://developer.blender.org/rBc19d2f2507a45d2a6da35dbe2ff842f71c2daae0

Cleanup: use MEM_recallocN_id

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

M	source/blender/bmesh/intern/bmesh_operators.c
M	source/blender/editors/space_console/console_ops.c

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

diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index d4a3ecb73db..2ec7e06a264 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -740,11 +740,7 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd)
 
       allocsize = BMO_OPSLOT_TYPEINFO[bmo_opdefines[op->type]->slot_types[slot_code].type] *
                   slot->size;
-
-      tmp = slot->data.buf;
-      slot->data.buf = MEM_callocN(allocsize, "opslot dynamic array");
-      memcpy(slot->data.buf, tmp, allocsize);
-      MEM_freeN(tmp);
+      slot->data.buf = MEM_recallocN_id(slot->data.buf, allocsize, "opslot dynamic array");
     }
 
     slot->len += totadd;
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 278981d2091..122634f86ba 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -233,11 +233,7 @@ static void console_line_verify_length(ConsoleLine *ci, int len)
 #else
     int new_len = (len + 1) * 2;
 #endif
-    char *new_line = MEM_callocN(new_len, "console line");
-    memcpy(new_line, ci->line, ci->len);
-    MEM_freeN(ci->line);
-
-    ci->line = new_line;
+    ci->line = MEM_recallocN_id(ci->line, new_len, "console line");
     ci->len_alloc = new_len;
   }
 }



More information about the Bf-blender-cvs mailing list