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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-10-22 17:00:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-22 17:00:02 +0400
commit436bbdfd247f66a856b17e4e73db8f8fb3fe6d6d (patch)
treec72eb1ce03d701a7a99ab0b039f89b20af28374c /source/blender/blenlib/intern
parent4e11fe6c5aec1d609e3ecc2218138b838d253ebf (diff)
style cleanup: use more const's in BLI_heap & dpx/cineon style cleanup
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/BLI_heap.c17
-rw-r--r--source/blender/blenlib/intern/BLI_kdtree.c6
2 files changed, 12 insertions, 11 deletions
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index 42dca360f4c..dcc028630e2 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -84,10 +84,13 @@ BLI_INLINE void heap_swap(Heap *heap, const unsigned int i, const unsigned int j
static void heap_down(Heap *heap, unsigned int i)
{
+ /* size won't change in the loop */
+ const unsigned int size = heap->size;
+
while (1) {
- unsigned int size = heap->size,smallest ;
- unsigned int l = HEAP_LEFT(i);
- unsigned int r = HEAP_RIGHT(i);
+ const unsigned int l = HEAP_LEFT(i);
+ const unsigned int r = HEAP_RIGHT(i);
+ unsigned int smallest;
smallest = ((l < size) && HEAP_COMPARE(heap->tree[l], heap->tree[i])) ? l : i;
@@ -105,7 +108,7 @@ static void heap_down(Heap *heap, unsigned int i)
static void heap_up(Heap *heap, unsigned int i)
{
while (i > 0) {
- unsigned int p = HEAP_PARENT(i);
+ const unsigned int p = HEAP_PARENT(i);
if (HEAP_COMPARE(heap->tree[p], heap->tree[i]))
break;
@@ -139,9 +142,11 @@ void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp)
{
unsigned int i;
- if (ptrfreefp)
- for (i = 0; i < heap->size; i++)
+ if (ptrfreefp) {
+ for (i = 0; i < heap->size; i++) {
ptrfreefp(heap->tree[i]->ptr);
+ }
+ }
MEM_freeN(heap->tree);
BLI_memarena_free(heap->arena);
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index 900580317f2..dd6c25ab6ad 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -30,16 +30,12 @@
* \ingroup bli
*/
-
-
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_kdtree.h"
+#include "BLI_utildefines.h"
-#ifndef SWAP
-# define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0
-#endif
typedef struct KDTreeNode {
struct KDTreeNode *left, *right;