[Bf-blender-cvs] [70fca255fe9] usd-importer-T81257-merge: USD import: use __func__ for MEM_callocN() names.

makowalski noreply at git.blender.org
Tue May 11 03:56:36 CEST 2021


Commit: 70fca255fe910884b67a63f05cdc34d96d0c1d87
Author: makowalski
Date:   Mon May 10 19:18:32 2021 -0400
Branches: usd-importer-T81257-merge
https://developer.blender.org/rB70fca255fe910884b67a63f05cdc34d96d0c1d87

USD import: use __func__ for MEM_callocN() names.

Per suggestion from Hans Goudey in his review, I replaced
hard-coded names with the __func__ macro for MED_callocN()
name arguments, to help ensure names do not become obsolete
in the future.

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

M	source/blender/io/usd/intern/usd_reader_curve.cc
M	source/blender/io/usd/intern/usd_reader_nurbs.cc

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

diff --git a/source/blender/io/usd/intern/usd_reader_curve.cc b/source/blender/io/usd/intern/usd_reader_curve.cc
index 0d2097c6f7c..28e2abbdcb4 100644
--- a/source/blender/io/usd/intern/usd_reader_curve.cc
+++ b/source/blender/io/usd/intern/usd_reader_curve.cc
@@ -135,7 +135,7 @@ void USDCurvesReader::read_curve_sample(Curve *cu, const double motionSampleTime
   size_t idx = 0;
   for (size_t i = 0; i < num_subcurves; i++) {
     const int num_verts = usdCounts[i];
-    Nurb *nu = static_cast<Nurb *>(MEM_callocN(sizeof(Nurb), "usd_getnurb"));
+    Nurb *nu = static_cast<Nurb *>(MEM_callocN(sizeof(Nurb), __func__));
 
     if (basis == pxr::UsdGeomTokens->bspline) {
       nu->flag = CU_SMOOTH;
@@ -172,7 +172,7 @@ void USDCurvesReader::read_curve_sample(Curve *cu, const double motionSampleTime
 
     float weight = 1.0f;
 
-    nu->bp = static_cast<BPoint *>(MEM_callocN(sizeof(BPoint) * nu->pntsu, "usd_getnurb"));
+    nu->bp = static_cast<BPoint *>(MEM_callocN(sizeof(BPoint) * nu->pntsu, __func__));
     BPoint *bp = nu->bp;
 
     for (int j = 0; j < nu->pntsu; j++, bp++, idx++) {
diff --git a/source/blender/io/usd/intern/usd_reader_nurbs.cc b/source/blender/io/usd/intern/usd_reader_nurbs.cc
index 7ace62ad804..e36c3a277d7 100644
--- a/source/blender/io/usd/intern/usd_reader_nurbs.cc
+++ b/source/blender/io/usd/intern/usd_reader_nurbs.cc
@@ -65,7 +65,7 @@ static bool set_knots(const pxr::VtDoubleArray &knots, float *&nu_knots)
 
   /* Skip first and last knots, as they are used for padding. */
   const size_t num_knots = knots.size();
-  nu_knots = static_cast<float *>(MEM_callocN(num_knots * sizeof(float), "usd_setsplineknotsu"));
+  nu_knots = static_cast<float *>(MEM_callocN(num_knots * sizeof(float), __func__));
 
   for (size_t i = 0; i < num_knots; i++) {
     nu_knots[i] = (float)knots[i];
@@ -143,7 +143,7 @@ void USDNurbsReader::read_curve_sample(Curve *cu, const double motionSampleTime)
   for (size_t i = 0; i < num_subcurves; i++) {
     const int num_verts = usdCounts[i];
 
-    Nurb *nu = static_cast<Nurb *>(MEM_callocN(sizeof(Nurb), "usd_getnurb"));
+    Nurb *nu = static_cast<Nurb *>(MEM_callocN(sizeof(Nurb), __func__));
     nu->flag = CU_SMOOTH;
     nu->type = CU_NURBS;
 
@@ -172,7 +172,7 @@ void USDNurbsReader::read_curve_sample(Curve *cu, const double motionSampleTime)
 
     float weight = 1.0f;
 
-    nu->bp = static_cast<BPoint *>(MEM_callocN(sizeof(BPoint) * nu->pntsu, "usd_getnurb"));
+    nu->bp = static_cast<BPoint *>(MEM_callocN(sizeof(BPoint) * nu->pntsu, __func__));
     BPoint *bp = nu->bp;
 
     for (int j = 0; j < nu->pntsu; j++, bp++, idx++) {



More information about the Bf-blender-cvs mailing list