Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-06-19 23:59:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-19 23:59:49 +0400
commit998101763aae5b0d25f6fa0f1a3227e45bb03b1e (patch)
tree95b479a8355329004e2dacc244415b5783d71154 /source
parent881dbac5d93cffd2f6a9f5c3896d1c84ebfd0ce5 (diff)
correct for own regressions when refactoring select-path, was using heap popmin incorrectly.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/intern/BLI_heap.c3
-rw-r--r--source/blender/bmesh/tools/bmesh_path.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index a8fdcd56abb..2da36377e55 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -30,6 +30,7 @@
* \ingroup bli
*/
+#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
@@ -207,6 +208,8 @@ void *BLI_heap_popmin(Heap *heap)
{
void *ptr = heap->tree[0]->ptr;
+ BLI_assert(heap->size == 0);
+
heap->tree[0]->ptr = heap->freenodes;
heap->freenodes = heap->tree[0];
diff --git a/source/blender/bmesh/tools/bmesh_path.c b/source/blender/bmesh/tools/bmesh_path.c
index eda252f18f5..9fc1996e51a 100644
--- a/source/blender/bmesh/tools/bmesh_path.c
+++ b/source/blender/bmesh/tools/bmesh_path.c
@@ -144,7 +144,8 @@ LinkNode *BM_mesh_calc_path_vert(
BLI_heap_insert(heap, 0.0f, v_src);
cost[BM_elem_index_get(v_src)] = 0.0f;
- while ((v = BLI_heap_popmin(heap))) {
+ while (!BLI_heap_is_empty(heap)) {
+ v = BLI_heap_popmin(heap);
if (v == v_dst)
break;
@@ -261,7 +262,8 @@ LinkNode *BM_mesh_calc_path_edge(
BLI_heap_insert(heap, 0.0f, e_src);
cost[BM_elem_index_get(e_src)] = 0.0f;
- while ((e = BLI_heap_popmin(heap))) {
+ while (!BLI_heap_is_empty(heap)) {
+ e = BLI_heap_popmin(heap);
if (e == e_dst)
break;
@@ -386,7 +388,8 @@ LinkNode *BM_mesh_calc_path_face(
BLI_heap_insert(heap, 0.0f, f_src);
cost[BM_elem_index_get(f_src)] = 0.0f;
- while ((f = BLI_heap_popmin(heap))) {
+ while (!BLI_heap_is_empty(heap)) {
+ f = BLI_heap_popmin(heap);
if (f == f_dst)
break;