[Bf-blender-cvs] [20b749d] temp-ghash-basis: rename ghash_buckets_shrink -> ghash_buckets_contract

Campbell Barton noreply at git.blender.org
Thu Mar 19 16:53:34 CET 2015


Commit: 20b749d0d563ba5f7a4dd7339c9ee10685da158e
Author: Campbell Barton
Date:   Fri Mar 20 02:51:55 2015 +1100
Branches: temp-ghash-basis
https://developer.blender.org/rB20b749d0d563ba5f7a4dd7339c9ee10685da158e

rename ghash_buckets_shrink -> ghash_buckets_contract

keep (expand/contract), (grow/shrink) separate

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

M	source/blender/blenlib/intern/BLI_ghash.c

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

diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 6d6db6a..f6ddbfe 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -74,8 +74,8 @@ const unsigned int hashsizes[] = {
  * about 25% - 30% quicker 'dynamic-topology' stroke drawing e.g.).
  * Min load #GHASH_LIMIT_SHRINK is a quarter of max load, to avoid resizing to quickly.
  */
-#define GHASH_LIMIT_GROW(_nbkt) ((_nbkt) * 3) / 4
-#define GHASH_LIMIT_SHRINK(_nbkt) ((_nbkt) * 3) / 16
+#define GHASH_LIMIT_GROW(_nbkt)   (((_nbkt) * 3) /  4)
+#define GHASH_LIMIT_SHRINK(_nbkt) (((_nbkt) * 3) / 16)
 
 /***/
 
@@ -281,7 +281,7 @@ static void ghash_buckets_expand(
 	ghash_buckets_resize(gh, new_nbuckets);
 }
 
-static void ghash_buckets_shrink(
+static void ghash_buckets_contract(
         GHash *gh, const unsigned int nentries, const bool user_defined, const bool force_shrink)
 {
 	unsigned int new_nbuckets;
@@ -536,7 +536,7 @@ static Entry *ghash_remove_ex(
 		if (e_prev) e_prev->next = e->next;
 		else gh->buckets[bucket_hash] = e->next;
 
-		ghash_buckets_shrink(gh, --gh->nentries, false, false);
+		ghash_buckets_contract(gh, --gh->nentries, false, false);
 	}
 
 	return e;
@@ -643,7 +643,7 @@ GHash *BLI_ghash_copy(GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcop
 void BLI_ghash_reserve(GHash *gh, const unsigned int nentries_reserve)
 {
 	ghash_buckets_expand(gh, nentries_reserve, true);
-	ghash_buckets_shrink(gh, nentries_reserve, true, false);
+	ghash_buckets_contract(gh, nentries_reserve, true, false);
 }
 
 /**




More information about the Bf-blender-cvs mailing list