diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-20 05:02:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-20 05:02:39 +0400 |
commit | 25c96bc9f348814d50095710c30ddc2776f5bb12 (patch) | |
tree | d462c55b492afaa4e52077475af8af984418c6fc /source/blender/blenlib | |
parent | 5d56a901a8b5f103cc2511941e70f6daa0bd9a3a (diff) |
code cleanup: remove unused macros, commet some which may be useful later - or good to keep for completeness. quieted some warnings and add flags -Wmissing-include-dirs and -Wno-div-by-zero to cmake/gcc
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_dynstr.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_base.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_heap.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 11 | ||||
-rw-r--r-- | source/blender/blenlib/intern/boxpack2d.c | 16 | ||||
-rw-r--r-- | source/blender/blenlib/intern/freetypefont.c | 3 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/noise.c | 3 |
8 files changed, 24 insertions, 20 deletions
diff --git a/source/blender/blenlib/BLI_dynstr.h b/source/blender/blenlib/BLI_dynstr.h index 1fa0a3aee8a..833c416c1c1 100644 --- a/source/blender/blenlib/BLI_dynstr.h +++ b/source/blender/blenlib/BLI_dynstr.h @@ -111,7 +111,6 @@ char *BLI_dynstr_get_cstring(DynStr *ds); * * \param ds The DynStr of interest. * \param str The string to fill. - * \return The contents of \a ds as a c-string. */ void BLI_dynstr_get_cstring_ex(DynStr *ds, char *str); diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 886ed6f495d..6ee1498c855 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -30,8 +30,8 @@ * \ingroup bli */ -#ifdef WIN32 -#define _USE_MATH_DEFINES +#ifdef _MSC_VER +# define _USE_MATH_DEFINES #endif #include <math.h> diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index c1175192434..ee7d93ea1a9 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -58,7 +58,7 @@ struct Heap { #define HEAP_LEFT(i) ((i << 1) + 1) #define HEAP_RIGHT(i) ((i << 1) + 2) #define HEAP_COMPARE(a, b) (a->value < b->value) -#define HEAP_EQUALS(a, b) (a->value == b->value) +// #define HEAP_EQUALS(a, b) (a->value == b->value) // UNUSED #define HEAP_SWAP(heap, i, j) \ { \ SWAP(int, heap->tree[i]->index, heap->tree[j]->index); \ diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 2b3c314131b..167797946bc 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -42,7 +42,6 @@ #endif #define MAX_TREETYPE 32 -#define DEFAULT_FIND_NEAREST_HEAP_SIZE 1024 typedef struct BVHNode { struct BVHNode **children; @@ -114,6 +113,8 @@ static float KDOP_AXES[13][3] = { {0, 1.0, -1.0} }; +#if 0 + /* * Generic push and pop heap */ @@ -153,7 +154,6 @@ static float KDOP_AXES[13][3] = { heap[parent] = element; \ } (void)0 -#if 0 static int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, int *max_size, int size_per_item) { int new_max_size = *max_size * 2; @@ -1167,8 +1167,6 @@ typedef struct NodeDistance { } NodeDistance; -#define NodeDistance_priority(a, b) ( (a).dist < (b).dist) - // TODO: use a priority queue to reduce the number of nodes looked on static void dfs_find_nearest_dfs(BVHNearestData *data, BVHNode *node) { @@ -1211,6 +1209,11 @@ static void dfs_find_nearest_begin(BVHNearestData *data, BVHNode *node) #if 0 + +#define DEFAULT_FIND_NEAREST_HEAP_SIZE 1024 + +#define NodeDistance_priority(a, b) ( (a).dist < (b).dist) + static void NodeDistance_push_heap(NodeDistance *heap, int heap_size) PUSH_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size) diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index 5da719cd500..1c70a612c4f 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -73,7 +73,9 @@ typedef struct BoxVert { ((b)->v[BR]->x = (b)->v[TR]->x) #define UPDATE_V34Y(b) ((b)->v[TL]->y = (b)->v[TR]->y); \ ((b)->v[BR]->y = (b)->v[BL]->y) -#define UPDATE_V34(b) UPDATE_V34X(b); UPDATE_V34Y(b) + +/* UNUSED */ +// #define UPDATE_V34(b) UPDATE_V34X(b); UPDATE_V34Y(b) #define SET_BOXLEFT(b, f) (b)->v[TR]->x = f + (b)->w; \ (b)->v[BL]->x = f; \ @@ -93,8 +95,8 @@ typedef struct BoxVert { BOXRIGHT(b1) - EPSILON <= BOXLEFT(b2) || \ BOXTOP(b1) - EPSILON <= BOXBOTTOM(b2)) -#define MIN2(x, y) ((x) < (y) ? (x) : (y)) -#define MAX2(x, y) ((x) > (y) ? (x) : (y)) +/* compiler should inline */ +static float maxf(const float a, const float b) { return b > a ? b : a; } #if 0 #define BOXDEBUG(b) \ @@ -131,8 +133,8 @@ static int vertex_sort(const void *p1, const void *p2) v1 = vertarray + ((int *)p1)[0]; v2 = vertarray + ((int *)p2)[0]; - a1 = MAX2(v1->x + box_width, v1->y + box_height); - a2 = MAX2(v2->x + box_width, v2->y + box_height); + a1 = maxf(v1->x + box_width, v1->y + box_height); + a2 = maxf(v2->x + box_width, v2->y + box_height); /* sort largest to smallest */ if (a1 > a2) return 1; @@ -312,8 +314,8 @@ void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float * if (!isect) { /* maintain the total width and height */ - (*tot_width) = MAX2(BOXRIGHT(box), (*tot_width)); - (*tot_height) = MAX2(BOXTOP(box), (*tot_height)); + (*tot_width) = maxf(BOXRIGHT(box), (*tot_width)); + (*tot_height) = maxf(BOXTOP(box), (*tot_height)); /* Place the box */ vert->free &= ~quad_flags[j]; diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 597a645eb9c..85239270541 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -58,9 +58,6 @@ #include "DNA_packedFile_types.h" #include "DNA_curve_types.h" -#define myMIN_ASCII 32 -#define myMAX_ASCII 255 - /* local variables */ static FT_Library library; static FT_Error err; diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index f0ed23aabc9..e10b0b3298c 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -35,7 +35,9 @@ /******************************** Quaternions ********************************/ /* used to test is a quat is not normalized (only used for debug prints) */ -#define QUAT_EPSILON 0.0001 +#ifdef DEBUG +# define QUAT_EPSILON 0.0001 +#endif /* convenience, avoids setting Y axis everywhere */ void unit_axis_angle(float axis[3], float *angle) diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index bd83c5e018c..792bf929182 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -45,7 +45,8 @@ static float noise3_perlin(float vec[3]); //static float turbulence_perlin(float *point, float lofreq, float hifreq); //static float turbulencep(float noisesize, float x, float y, float z, int nr); -#define HASHVEC(x, y, z) hashvectf + 3 * hash[(hash[(hash[(z) & 255] + (y)) & 255] + (x)) & 255] +/* UNUSED */ +// #define HASHVEC(x, y, z) hashvectf + 3 * hash[(hash[(hash[(z) & 255] + (y)) & 255] + (x)) & 255] /* needed for voronoi */ #define HASHPNT(x, y, z) hashpntf + 3 * hash[(hash[(hash[(z) & 255] + (y)) & 255] + (x)) & 255] |