diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-07 03:53:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-07 03:53:58 +0300 |
commit | 5217d2bc0e29695bea74950ff05a9215a85ff703 (patch) | |
tree | f9c6761111496e748e7161f1998c531957bcc47c /source/blender/blenlib | |
parent | 808de65d9124d54ce82bcb1a4d84a78b3be7288c (diff) |
Use BKE_edgehash_ensure_p where possible
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/polyfill2d_beautify.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/polyfill2d_beautify.c b/source/blender/blenlib/intern/polyfill2d_beautify.c index ba71f52b530..46f9251bea7 100644 --- a/source/blender/blenlib/intern/polyfill2d_beautify.c +++ b/source/blender/blenlib/intern/polyfill2d_beautify.c @@ -430,17 +430,19 @@ void BLI_polyfill_beautify( } if (!is_boundary_edge(e_pair[0], e_pair[1], coord_last)) { - struct PolyEdge *e = BLI_edgehash_lookup(ehash, e_pair[0], e_pair[1]); - if (e == NULL) { + struct PolyEdge *e; + void **val_p; + + if (!BLI_edgehash_ensure_p(ehash, e_pair[0], e_pair[1], &val_p)) { e = &edges[edges_tot_used++]; - BLI_edgehash_insert(ehash, e_pair[0], e_pair[1], e); + *val_p = e; memcpy(e->verts, e_pair, sizeof(e->verts)); #ifndef NDEBUG e->faces[!e_index] = (unsigned int)-1; #endif } else { - + e = *val_p; /* ensure each edge only ever has 2x users */ #ifndef NDEBUG BLI_assert(e->faces[e_index] == (unsigned int)-1); |