[Bf-blender-cvs] [4f213c14953] blender2.8: Cleanup: naming (prefer len over num for new code)

Campbell Barton noreply at git.blender.org
Tue May 8 19:40:20 CEST 2018


Commit: 4f213c14953c182994dc3fe65e0602032733540e
Author: Campbell Barton
Date:   Tue May 8 19:36:02 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB4f213c14953c182994dc3fe65e0602032733540e

Cleanup: naming (prefer len over num for new code)

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

M	source/blender/blenkernel/intern/mesh_runtime.c
M	source/blender/makesdna/DNA_mesh_types.h

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

diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c
index 96fc472ac8f..aebf03151d1 100644
--- a/source/blender/blenkernel/intern/mesh_runtime.c
+++ b/source/blender/blenkernel/intern/mesh_runtime.c
@@ -54,28 +54,28 @@ static ThreadRWMutex loops_cache_lock = PTHREAD_RWLOCK_INITIALIZER;
 static void mesh_ensure_looptri_data(Mesh *mesh)
 {
 	const unsigned int totpoly = mesh->totpoly;
-	const int looptris_num = poly_to_tri_count(totpoly, mesh->totloop);
+	const int looptris_len = poly_to_tri_count(totpoly, mesh->totloop);
 
 	BLI_assert(mesh->runtime.looptris.array_wip == NULL);
 
 	SWAP(MLoopTri *, mesh->runtime.looptris.array, mesh->runtime.looptris.array_wip);
 
-	if ((looptris_num > mesh->runtime.looptris.num_alloc) ||
-	    (looptris_num < mesh->runtime.looptris.num_alloc * 2) ||
+	if ((looptris_len > mesh->runtime.looptris.len_alloc) ||
+	    (looptris_len < mesh->runtime.looptris.len_alloc * 2) ||
 	    (totpoly == 0))
 	{
 		MEM_SAFE_FREE(mesh->runtime.looptris.array_wip);
-		mesh->runtime.looptris.num_alloc = 0;
-		mesh->runtime.looptris.num = 0;
+		mesh->runtime.looptris.len_alloc = 0;
+		mesh->runtime.looptris.len = 0;
 	}
 
 	if (totpoly) {
 		if (mesh->runtime.looptris.array_wip == NULL) {
-			mesh->runtime.looptris.array_wip = MEM_malloc_arrayN(looptris_num, sizeof(*mesh->runtime.looptris.array_wip), __func__);
-			mesh->runtime.looptris.num_alloc = looptris_num;
+			mesh->runtime.looptris.array_wip = MEM_malloc_arrayN(looptris_len, sizeof(*mesh->runtime.looptris.array_wip), __func__);
+			mesh->runtime.looptris.len_alloc = looptris_len;
 		}
 
-		mesh->runtime.looptris.num = looptris_num;
+		mesh->runtime.looptris.len = looptris_len;
 	}
 }
 
@@ -100,7 +100,7 @@ void BKE_mesh_runtime_looptri_recalc(Mesh *mesh)
 int BKE_mesh_runtime_looptri_len(const Mesh *mesh)
 {
 	const int looptri_len = poly_to_tri_count(mesh->totpoly, mesh->totloop);
-	BLI_assert(ELEM(mesh->runtime.looptris.num, 0, looptri_len));
+	BLI_assert(ELEM(mesh->runtime.looptris.len, 0, looptri_len));
 	return looptri_len;
 }
 
@@ -114,7 +114,7 @@ const MLoopTri *BKE_mesh_runtime_looptri_ensure(Mesh *mesh)
 	BLI_rw_mutex_unlock(&loops_cache_lock);
 
 	if (looptri != NULL) {
-		BLI_assert(BKE_mesh_runtime_looptri_len(mesh) == mesh->runtime.looptris.num);
+		BLI_assert(BKE_mesh_runtime_looptri_len(mesh) == mesh->runtime.looptris.len);
 	}
 	else {
 		BLI_rw_mutex_lock(&loops_cache_lock, THREAD_LOCK_WRITE);
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index d90d5227e17..5ce24916c54 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -71,12 +71,12 @@ typedef struct EditMeshData {
 /**
  * \warning Typical access is done via #BKE_mesh_runtime_looptri_ensure, #BKE_mesh_runtime_looptri_len.
  */
-struct LooptrisData {
+struct MLoopTri_Store {
 	/* WARNING! swapping between array (ready-to-be-used data) and array_wip (where data is actually computed)
 	 *          shall always be protected by same lock as one used for looptris computing. */
 	struct MLoopTri *array, *array_wip;
-	int num;
-	int num_alloc;
+	int len;
+	int len_alloc;
 };
 
 /* not saved in file! */
@@ -89,7 +89,7 @@ typedef struct MeshRuntime {
 	int64_t cd_dirty_loop;
 	int64_t cd_dirty_poly;
 
-	struct LooptrisData looptris;
+	struct MLoopTri_Store looptris;
 
 	/** 'BVHCache', for 'BKE_bvhutil.c' */
 	struct LinkNode *bvh_cache;



More information about the Bf-blender-cvs mailing list