[Bf-blender-cvs] [a8a9a9d] temp-array-modifier: Cleanup: redundant casts
Campbell Barton
noreply at git.blender.org
Tue Aug 12 05:17:48 CEST 2014
Commit: a8a9a9d9ffef8c6a7743c928077a397309d9660c
Author: Campbell Barton
Date: Tue Aug 12 13:17:32 2014 +1000
Branches: temp-array-modifier
https://developer.blender.org/rBa8a9a9d9ffef8c6a7743c928077a397309d9660c
Cleanup: redundant casts
===================================================================
M source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 3247295..9d3977d 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -2717,17 +2717,17 @@ typedef struct PolyKey {
static unsigned int poly_ghash_hash_fn(const void *key)
{
- PolyKey *pk = (PolyKey *)key;
+ const PolyKey *pk = key;
return pk->hash_sum;
}
static int poly_ghash_compare_fn(const void *k1, const void *k2)
{
- PolyKey *pk1 = (PolyKey*)k1;
- PolyKey *pk2 = (PolyKey*)k2;
- if (pk1->hash_sum == pk2->hash_sum &&
- pk1->hash_xor == pk2->hash_xor &&
- pk1->totloops == pk2->totloops)
+ const PolyKey *pk1 = k1;
+ const PolyKey *pk2 = k2;
+ if ((pk1->hash_sum == pk2->hash_sum) &&
+ (pk1->hash_xor == pk2->hash_xor) &&
+ (pk1->totloops == pk2->totloops))
{
/* Equality - note that this does not mean equality of polys */
return 0;
@@ -2877,8 +2877,8 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
/* if the targets already make up a poly, in which case the new poly is dropped */
/* This poly equality check is rather complex. We use a BLI_ghash to speed it up with a first level check */
PolyKey *mpgh;
- poly_keys = MEM_mallocN(sizeof(PolyKey)* totpoly, "CDDM_merge_verts poly keys");
- poly_ghash = BLI_ghash_new_ex(poly_ghash_hash_fn, poly_ghash_compare_fn, "CDDM_merge_verts poly hash", totpoly);
+ poly_keys = MEM_mallocN(sizeof(PolyKey) * totpoly, __func__);
+ poly_ghash = BLI_ghash_new_ex(poly_ghash_hash_fn, poly_ghash_compare_fn, __func__, totpoly);
/* Duplicates allowed because our compare function is not pure equality */
BLI_ghash_flag_set(poly_ghash, GHASH_FLAG_ALLOW_DUPES);
@@ -3028,7 +3028,10 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
STACK_PUSH(oldp, i);
} /* end of the loop that tests polys */
+
if (poly_ghash) {
+ // printf("hash quality %.6f\n", BLI_ghash_calc_quality(poly_ghash));
+
BLI_ghash_free(poly_ghash, NULL, NULL);
MEM_freeN(poly_keys);
}
More information about the Bf-blender-cvs
mailing list