diff options
author | Neil Roberts <[email protected]> | 2010-06-30 12:41:11 +0100 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-06-30 07:59:39 -0600 |
commit | 75acb896c6da758d03e86f8725d6ca0cb2c6ad82 (patch) | |
tree | e6340c592f1af38693ddca49f1aa7ddef19a93d7 /src/glu/sgi/libtess/priorityq.c | |
parent | a8815b754d9f64fce32bbfdcdf58dfed62a8aa3c (diff) |
glu: Fix some compiler warnings in libtess
When compiled with the more aggressive compiler warnings such as
-Wshadow and -Wempty-body the libtess code gives a lot more
warnings. This fixes the following issues:
* The 'Swap' macro tries to combine multiple statements into one and
then consume the trailing semicolon by using if(1){/*...*/}else.
This gives warnings because the else part ends up with an empty
statement. It also seems a bit dangerous because if the semicolon
were missed then it would still be valid syntax but it would just
ignore the following statement. This patch replaces it with the more
common idiom do { /*...*/ } while(0).
* 'free' was being used as a local variable name but this shadows the
global function. This has been renamed to 'free_handle'
* TRUE and FALSE were being unconditionally defined. Although this
isn't currently a problem it seems better to guard them with #ifndef
because it's quite common for them to be defined in other headers.
https://bugs.freedesktop.org/show_bug.cgi?id=28845
Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/glu/sgi/libtess/priorityq.c')
-rw-r--r-- | src/glu/sgi/libtess/priorityq.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/glu/sgi/libtess/priorityq.c b/src/glu/sgi/libtess/priorityq.c index 11f0263ac93..c6b99cce552 100644 --- a/src/glu/sgi/libtess/priorityq.c +++ b/src/glu/sgi/libtess/priorityq.c @@ -85,7 +85,7 @@ void pqDeletePriorityQ( PriorityQ *pq ) #define LT(x,y) (! LEQ(y,x)) #define GT(x,y) (! LEQ(x,y)) -#define Swap(a,b) if(1){PQkey *tmp = *a; *a = *b; *b = tmp;}else +#define Swap(a,b) do{PQkey *tmp = *a; *a = *b; *b = tmp;}while(0) /* really __gl_pqSortInit */ int pqInit( PriorityQ *pq ) |