[Bf-blender-cvs] [6ab634ccc47] master: Cleanup: use specific names for global variables

Campbell Barton noreply at git.blender.org
Sat Feb 23 09:39:48 CET 2019


Commit: 6ab634ccc477fb704fce45663f170e500d5694b8
Author: Campbell Barton
Date:   Sat Feb 23 17:47:33 2019 +1100
Branches: master
https://developer.blender.org/rB6ab634ccc477fb704fce45663f170e500d5694b8

Cleanup: use specific names for global variables

hash & hashsizes are generic names, be more specific & define the
generic names locally.

Quiet undeclared variable warnings.

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

M	source/blender/blenlib/intern/BLI_ghash.c
M	source/blender/blenlib/intern/noise.c
M	source/blender/blenlib/intern/rand.c
M	source/blender/blenlib/intern/smallhash.c

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

diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 298c9ca4d39..fc432c8c8b7 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -54,12 +54,14 @@
  *
  * \note Also used by: `BLI_edgehash` & `BLI_smallhash`.
  */
-const uint hashsizes[] = {
+extern const uint BLI_ghash_hash_sizes[];  /* Quiet warning, this is only used by smallhash.c */
+const uint BLI_ghash_hash_sizes[] = {
 	5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209,
 	16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169,
 	4194319, 8388617, 16777259, 33554467, 67108879, 134217757,
 	268435459,
 };
+#define hashsizes BLI_ghash_hash_sizes
 
 #ifdef GHASH_USE_MODULO_BUCKETS
 #  define GHASH_MAX_SIZE 27
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 1db3040e3db..8126bdfb3ef 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -148,7 +148,8 @@ static const float hashpntf[768] = {
 	0.114246, 0.905043, 0.713870, 0.555261, 0.951333,
 };
 
-const unsigned char hash[512] = {
+extern const unsigned char BLI_noise_hash_uchar_512[512];  /* Quiet warning. */
+const unsigned char BLI_noise_hash_uchar_512[512] = {
 	0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0,  0xDE, 0x95, 0x2E, 0xDC,
 	0x3F, 0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC,  0x79, 0x32, 0xD1, 0x59, 0xF4, 0x8,  0x8B, 0x63,
 	0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83, 0xF2, 0x8F, 0x18, 0xC7, 0x51, 0x14, 0x65, 0x87, 0x48, 0x20, 0x42, 0xA8, 0x80,
@@ -177,6 +178,7 @@ const unsigned char hash[512] = {
 	0xE5, 0xAF, 0x53, 0x7,  0xE0, 0x29, 0xA6, 0xC5, 0xE3, 0xF5, 0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E, 0x52, 0x2D,
 	0x21, 0xAD, 0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, 0x1A, 0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB, 0x5D,
 };
+#define hash BLI_noise_hash_uchar_512
 
 
 static const float hashvectf[768] = {
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c
index e453d5a01f8..764d0c48f0d 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -46,7 +46,8 @@
 #define ADDEND      0xB
 #define LOWSEED     0x330E
 
-extern unsigned char hash[];    // noise.c
+extern unsigned char BLI_noise_hash_uchar_512[512];  /* noise.c */
+#define hash BLI_noise_hash_uchar_512
 
 /**
  * Random Number Generator.
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c
index 142f0a991c8..b012ff36bf1 100644
--- a/source/blender/blenlib/intern/smallhash.c
+++ b/source/blender/blenlib/intern/smallhash.c
@@ -79,7 +79,8 @@ BLI_INLINE bool smallhash_val_is_used(const void *val)
 #endif
 }
 
-extern const uint hashsizes[];
+extern const uint BLI_ghash_hash_sizes[];
+#define hashsizes BLI_ghash_hash_sizes
 
 BLI_INLINE uint smallhash_key(const uintptr_t key)
 {



More information about the Bf-blender-cvs mailing list