diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-20 20:49:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-20 20:49:02 +0400 |
commit | 46b40e112b075a9a5a9d26e089f8e28c20257f19 (patch) | |
tree | aa12733862ecdf0abb93f8deb56bd389f1ae997d /source/blender/blenlib/intern/smallhash.c | |
parent | 106d41699aaa94ed8917c44c6f18a71f8a25e7a3 (diff) |
skip checks in statvis_calc_thickness(). also remove paranoid NULL checks in smallhash.c
Diffstat (limited to 'source/blender/blenlib/intern/smallhash.c')
-rw-r--r-- | source/blender/blenlib/intern/smallhash.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c index 64bb503fa3c..c24b495bfb6 100644 --- a/source/blender/blenlib/intern/smallhash.c +++ b/source/blender/blenlib/intern/smallhash.c @@ -43,6 +43,10 @@ #define SMHASH_CELL_UNUSED ((void *)0x7FFFFFFF) #define SMHASH_CELL_FREE ((void *)0x7FFFFFFD) +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wstrict-overflow" +#endif + BLI_INLINE int smhash_nonzero(const int n) { return n + !n; @@ -83,10 +87,6 @@ void BLI_smallhash_init(SmallHash *hash) /*NOTE: does *not* free *hash itself! only the direct data!*/ void BLI_smallhash_release(SmallHash *hash) { - if (hash == NULL) { - return; - } - if (hash->table != hash->stacktable) { MEM_freeN(hash->table); } @@ -181,10 +181,6 @@ void *BLI_smallhash_lookup(SmallHash *hash, uintptr_t key) h = ABS((int)key); - if (hash->table == NULL) { - return NULL; - } - while ((hash->table[h % hash->size].key != key) || (hash->table[h % hash->size].val == SMHASH_CELL_UNUSED)) { @@ -209,10 +205,6 @@ int BLI_smallhash_haskey(SmallHash *hash, uintptr_t key) int h = ABS((int)key); int hoff = 1; - if (hash->table == NULL) { - return 0; - } - while ((hash->table[h % hash->size].key != key) || (hash->table[h % hash->size].val == SMHASH_CELL_UNUSED)) { @@ -234,8 +226,8 @@ int BLI_smallhash_count(SmallHash *hash) void *BLI_smallhash_iternext(SmallHashIter *iter, uintptr_t *key) { while (iter->i < iter->hash->size) { - if ( (iter->hash->table[iter->i].val != SMHASH_CELL_UNUSED) && - (iter->hash->table[iter->i].val != SMHASH_CELL_FREE)) + if ((iter->hash->table[iter->i].val != SMHASH_CELL_UNUSED) && + (iter->hash->table[iter->i].val != SMHASH_CELL_FREE)) { if (key) { *key = iter->hash->table[iter->i].key; |