[Bf-blender-cvs] [a8ec7845e0b] master: Cleanup: use "num" as a suffix in: source/blender/blenlib

Campbell Barton noreply at git.blender.org
Wed Mar 30 09:02:42 CEST 2022


Commit: a8ec7845e0bdb9e63e9d3dbd7f4cd7caad36b5a2
Author: Campbell Barton
Date:   Wed Mar 30 17:26:42 2022 +1100
Branches: master
https://developer.blender.org/rBa8ec7845e0bdb9e63e9d3dbd7f4cd7caad36b5a2

Cleanup: use "num" as a suffix in: source/blender/blenlib

Also replace "num" with:
- "number" when it's not used to denote the number of items.
- "digits" when digits in a string are being manipulated.

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

M	source/blender/blenlib/BLI_bitmap.h
M	source/blender/blenlib/BLI_heap.h
M	source/blender/blenlib/BLI_heap_simple.h
M	source/blender/blenlib/BLI_kdopbvh.h
M	source/blender/blenlib/BLI_math_geom.h
M	source/blender/blenlib/BLI_mempool.h
M	source/blender/blenlib/BLI_path_util.h
M	source/blender/blenlib/BLI_polyfill_2d.h
M	source/blender/blenlib/BLI_polyfill_2d_beautify.h
M	source/blender/blenlib/BLI_rand.h
M	source/blender/blenlib/BLI_scanfill.h
M	source/blender/blenlib/BLI_task.h
M	source/blender/blenlib/BLI_utildefines_stack.h
M	source/blender/blenlib/intern/BLI_heap.c
M	source/blender/blenlib/intern/BLI_heap_simple.c
M	source/blender/blenlib/intern/BLI_kdopbvh.c
M	source/blender/blenlib/intern/BLI_mempool.c
M	source/blender/blenlib/intern/BLI_mempool_private.h
M	source/blender/blenlib/intern/bitmap.c
M	source/blender/blenlib/intern/convexhull_2d.c
M	source/blender/blenlib/intern/delaunay_2d.cc
M	source/blender/blenlib/intern/filereader_zstd.c
M	source/blender/blenlib/intern/gsqueue.c
M	source/blender/blenlib/intern/jitter_2d.c
M	source/blender/blenlib/intern/math_geom.c
M	source/blender/blenlib/intern/mesh_boolean.cc
M	source/blender/blenlib/intern/mesh_intersect.cc
M	source/blender/blenlib/intern/path_util.c
M	source/blender/blenlib/intern/polyfill_2d.c
M	source/blender/blenlib/intern/polyfill_2d_beautify.c
M	source/blender/blenlib/intern/rand.cc
M	source/blender/blenlib/intern/scanfill.c
M	source/blender/blenlib/intern/scanfill_utils.c
M	source/blender/blenlib/intern/stack.c
M	source/blender/blenlib/intern/string.c
M	source/blender/blenlib/intern/task_iterator.c
M	source/blender/blenlib/intern/task_scheduler.cc
M	source/blender/blenlib/intern/threads.cc
M	source/blender/blenlib/intern/uuid.cc
M	source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
M	source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc
M	source/blender/blenlib/tests/BLI_listbase_test.cc
M	source/blender/blenlib/tests/BLI_memiter_test.cc
M	source/blender/blenlib/tests/BLI_mesh_intersect_test.cc
M	source/blender/blenlib/tests/BLI_polyfill_2d_test.cc
M	source/blender/blenlib/tests/BLI_string_test.cc
M	source/blender/blenlib/tests/BLI_string_utf8_test.cc
M	source/blender/blenlib/tests/BLI_task_test.cc
M	source/blender/blenlib/tests/performance/BLI_task_performance_test.cc

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

diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h
index 38c44193ab3..ca11cd6574e 100644
--- a/source/blender/blenlib/BLI_bitmap.h
+++ b/source/blender/blenlib/BLI_bitmap.h
@@ -25,33 +25,33 @@ typedef unsigned int BLI_bitmap;
 #define _BITMAP_MASK 31
 
 /**
- * Number of blocks needed to hold '_tot' bits.
+ * Number of blocks needed to hold '_num' bits.
  */
-#define _BITMAP_NUM_BLOCKS(_tot) (((_tot) >> _BITMAP_POWER) + 1)
+#define _BITMAP_NUM_BLOCKS(_num) (((_num) >> _BITMAP_POWER) + 1)
 
 /**
- * Size (in bytes) used to hold '_tot' bits.
+ * Size (in bytes) used to hold '_num' bits.
  */
-#define BLI_BITMAP_SIZE(_tot) ((size_t)(_BITMAP_NUM_BLOCKS(_tot)) * sizeof(BLI_bitmap))
+#define BLI_BITMAP_SIZE(_num) ((size_t)(_BITMAP_NUM_BLOCKS(_num)) * sizeof(BLI_bitmap))
 
 /**
- * Allocate memory for a bitmap with '_tot' bits; free with MEM_freeN().
+ * Allocate memory for a bitmap with '_num' bits; free with MEM_freeN().
  */
-#define BLI_BITMAP_NEW(_tot, _alloc_string) \
-  ((BLI_bitmap *)MEM_callocN(BLI_BITMAP_SIZE(_tot), _alloc_string))
+#define BLI_BITMAP_NEW(_num, _alloc_string) \
+  ((BLI_bitmap *)MEM_callocN(BLI_BITMAP_SIZE(_num), _alloc_string))
 
 /**
  * Allocate a bitmap on the stack.
  */
-#define BLI_BITMAP_NEW_ALLOCA(_tot) \
-  ((BLI_bitmap *)memset(alloca(BLI_BITMAP_SIZE(_tot)), 0, BLI_BITMAP_SIZE(_tot)))
+#define BLI_BITMAP_NEW_ALLOCA(_num) \
+  ((BLI_bitmap *)memset(alloca(BLI_BITMAP_SIZE(_num)), 0, BLI_BITMAP_SIZE(_num)))
 
 /**
  * Allocate using given MemArena.
  */
-#define BLI_BITMAP_NEW_MEMARENA(_mem, _tot) \
+#define BLI_BITMAP_NEW_MEMARENA(_mem, _num) \
   (CHECK_TYPE_INLINE(_mem, MemArena *), \
-   ((BLI_bitmap *)BLI_memarena_calloc(_mem, BLI_BITMAP_SIZE(_tot))))
+   ((BLI_bitmap *)BLI_memarena_calloc(_mem, BLI_BITMAP_SIZE(_num))))
 
 /**
  * Get the value of a single bit at '_index'.
@@ -107,12 +107,12 @@ typedef unsigned int BLI_bitmap;
   (void)0
 
 /**
- * Resize bitmap to have space for '_tot' bits.
+ * Resize bitmap to have space for '_num' bits.
  */
-#define BLI_BITMAP_RESIZE(_bitmap, _tot) \
+#define BLI_BITMAP_RESIZE(_bitmap, _num) \
   { \
     CHECK_TYPE(_bitmap, BLI_bitmap *); \
-    (_bitmap) = MEM_recallocN(_bitmap, BLI_BITMAP_SIZE(_tot)); \
+    (_bitmap) = MEM_recallocN(_bitmap, BLI_BITMAP_SIZE(_num)); \
   } \
   (void)0
 
diff --git a/source/blender/blenlib/BLI_heap.h b/source/blender/blenlib/BLI_heap.h
index e8aa95f6aa7..882f40c1850 100644
--- a/source/blender/blenlib/BLI_heap.h
+++ b/source/blender/blenlib/BLI_heap.h
@@ -25,7 +25,7 @@ typedef void (*HeapFreeFP)(void *ptr);
  *
  * \note Use when the size of the heap is known in advance.
  */
-Heap *BLI_heap_new_ex(unsigned int tot_reserve) ATTR_WARN_UNUSED_RESULT;
+Heap *BLI_heap_new_ex(unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT;
 Heap *BLI_heap_new(void) ATTR_WARN_UNUSED_RESULT;
 void BLI_heap_clear(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1);
 void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1);
diff --git a/source/blender/blenlib/BLI_heap_simple.h b/source/blender/blenlib/BLI_heap_simple.h
index 79504096d67..4a63a6d624c 100644
--- a/source/blender/blenlib/BLI_heap_simple.h
+++ b/source/blender/blenlib/BLI_heap_simple.h
@@ -21,7 +21,7 @@ typedef void (*HeapSimpleFreeFP)(void *ptr);
  *
  * \note Use when the size of the heap is known in advance.
  */
-HeapSimple *BLI_heapsimple_new_ex(unsigned int tot_reserve) ATTR_WARN_UNUSED_RESULT;
+HeapSimple *BLI_heapsimple_new_ex(unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT;
 HeapSimple *BLI_heapsimple_new(void) ATTR_WARN_UNUSED_RESULT;
 void BLI_heapsimple_clear(HeapSimple *heap, HeapSimpleFreeFP ptrfreefp) ATTR_NONNULL(1);
 void BLI_heapsimple_free(HeapSimple *heap, HeapSimpleFreeFP ptrfreefp) ATTR_NONNULL(1);
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index 38f3e1ee290..8642d728909 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -181,18 +181,18 @@ int BLI_bvhtree_overlap_thread_num(const BVHTree *tree);
  */
 BVHTreeOverlap *BLI_bvhtree_overlap_ex(const BVHTree *tree1,
                                        const BVHTree *tree2,
-                                       uint *r_overlap_tot,
+                                       uint *r_overlap_num,
                                        BVHTree_OverlapCallback callback,
                                        void *userdata,
                                        uint max_interactions,
                                        int flag);
 BVHTreeOverlap *BLI_bvhtree_overlap(const BVHTree *tree1,
                                     const BVHTree *tree2,
-                                    unsigned int *r_overlap_tot,
+                                    unsigned int *r_overlap_num,
                                     BVHTree_OverlapCallback callback,
                                     void *userdata);
 
-int *BLI_bvhtree_intersect_plane(BVHTree *tree, float plane[4], uint *r_intersect_tot);
+int *BLI_bvhtree_intersect_plane(BVHTree *tree, float plane[4], uint *r_intersect_num);
 
 /**
  * Number of times #BLI_bvhtree_insert has been called.
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index c31e3045c97..9e65093a05f 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -890,7 +890,7 @@ bool clip_segment_v3_plane(
 bool clip_segment_v3_plane_n(const float p1[3],
                              const float p2[3],
                              const float plane_array[][4],
-                             int plane_tot,
+                             int plane_num,
                              float r_p1[3],
                              float r_p2[3]);
 
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h
index 740cf4dedb9..0313b743401 100644
--- a/source/blender/blenlib/BLI_mempool.h
+++ b/source/blender/blenlib/BLI_mempool.h
@@ -20,7 +20,7 @@ struct BLI_mempool_chunk;
 typedef struct BLI_mempool BLI_mempool;
 
 BLI_mempool *BLI_mempool_create(unsigned int esize,
-                                unsigned int totelem,
+                                unsigned int elem_num,
                                 unsigned int pchunk,
                                 unsigned int flag)
     ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 7b3e3e983f0..06dd9ab0db9 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -204,12 +204,12 @@ bool BLI_path_filename_ensure(char *filepath, size_t maxlen, const char *filenam
  * or before dot if no digits.
  * \param tail: Optional area to return copy of part of string following digits,
  * or from dot if no digits.
- * \param r_num_len: Optional to return number of digits found.
+ * \param r_digits_len: Optional to return number of digits found.
  */
 int BLI_path_sequence_decode(const char *string,
                              char *head,
                              char *tail,
-                             unsigned short *r_num_len);
+                             unsigned short *r_digits_len);
 /**
  * Returns in area pointed to by string a string of the form `<head><pic><tail>`,
  * where pic is formatted as `numlen` digits with leading zeroes.
@@ -310,7 +310,7 @@ bool BLI_path_frame_range(char *path, int sta, int end, int digits) ATTR_NONNULL
 /**
  * Get the frame from a filename formatted by blender's frame scheme
  */
-bool BLI_path_frame_get(char *path, int *r_frame, int *numdigits) ATTR_NONNULL();
+bool BLI_path_frame_get(char *path, int *r_frame, int *r_digits_len) ATTR_NONNULL();
 /**
  * Given a `path` with digits representing frame numbers, replace the digits with the '#'
  * character and extract the extension.
diff --git a/source/blender/blenlib/BLI_polyfill_2d.h b/source/blender/blenlib/BLI_polyfill_2d.h
index a551188737f..ccb4c856de3 100644
--- a/source/blender/blenlib/BLI_polyfill_2d.h
+++ b/source/blender/blenlib/BLI_polyfill_2d.h
@@ -16,7 +16,7 @@ struct MemArena;
  * A version of #BLI_polyfill_calc that uses a memory arena to avoid re-allocations.
  */
 void BLI_polyfill_calc_arena(const float (*coords)[2],
-                             unsigned int coords_tot,
+                             unsigned int coords_num,
                              int coords_sign,
                              unsigned int (*r_tris)[3],
 
@@ -27,16 +27,16 @@ void BLI_polyfill_calc_arena(const float (*coords)[2],
  *
  * \param coords: 2D coordinates describing vertices of the polygon,
  * in either clockwise or counterclockwise order.
- * \param coords_tot: Total points in the array.
+ * \param coords_num: Total points in the array.
  * \param coords_sign: Pass this when we know the sign in advance to avoid extra calculations.
  *
  * \param r_tris: This array is filled in with triangle indices in clockwise order.
- * The length of the array must be `coords_tot - 2`.
+ * The length of the array must be `coords_num - 2`.
  * Indices are guaranteed to be assigned to unique triangles, with valid indices,
  * even in the case of degenerate input (self intersecting polygons, zero area ears... etc).
  */
 void BLI_polyfill_calc(const float (*coords)[2],
-                       unsigned int coords_tot,
+                       unsigned int coords_num,
                        int coords_sign,
                        unsigned int (*r_tris)[3]);
 
diff --git a/source/blender/blenlib/BLI_polyfill_2d_beautify.h b/source/blender/blenlib/BLI_polyfill_2d_beautify.h
index c5a7cb80ff2..8e14bd5c641 100644
--- a/source/blender/blenlib/BLI_polyfill_2d_beautify.h
+++ b/source/blender/blenlib/BLI_polyfill_2d_beautify.h
@@ -20,7 +20,7 @@ struct MemArena;
  * are ignored since the edges won't share 2 faces.
  */
 void BLI_polyfill_beautify(const float (*coords)[2],
-                           unsigned int coords_tot,
+                           unsigned int coords_num,
                            unsigned int (*tris)[3],
 
                            /* structs for reuse */
diff --git a/source/blender/blenlib/

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list