summaryrefslogtreecommitdiff
path: root/libavutil/qsort.h
diff options
context:
space:
mode:
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-10-22 22:52:11 -0400
committerGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-10-23 08:41:16 -0400
commit8ed79c45b47f274c58180b8526f7a8cab061cbed (patch)
tree518ad927e84b954115ec332221913bea10dbd3b1 /libavutil/qsort.h
parent0c7b44a01c1564ef681d51a5ed37d3908558143b (diff)
avutil/qsort: use the do while form for AV_QSORT, AV_MSORT
Reviewed-by: Clément Bœsch <u@pkh.me> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Diffstat (limited to 'libavutil/qsort.h')
-rw-r--r--libavutil/qsort.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavutil/qsort.h b/libavutil/qsort.h
index 30edcc8371..eda24b023c 100644
--- a/libavutil/qsort.h
+++ b/libavutil/qsort.h
@@ -27,7 +27,7 @@
* to construct input that requires O(n^2) time but this is very unlikely to
* happen with non constructed input.
*/
-#define AV_QSORT(p, num, type, cmp) {\
+#define AV_QSORT(p, num, type, cmp) do {\
void *stack[64][2];\
int sp= 1;\
stack[0][0] = p;\
@@ -89,7 +89,7 @@
}\
}\
}\
-}
+} while (0)
/**
* Merge sort, this sort requires a temporary buffer and is stable, its worst
@@ -97,7 +97,7 @@
* @param p must be a lvalue pointer, this function may exchange it with tmp
* @param tmp must be a lvalue pointer, this function may exchange it with p
*/
-#define AV_MSORT(p, tmp, num, type, cmp) {\
+#define AV_MSORT(p, tmp, num, type, cmp) do {\
unsigned i, j, step;\
for(step=1; step<(num); step+=step){\
for(i=0; i<(num); i+=2*step){\
@@ -114,4 +114,4 @@
}\
FFSWAP(type*, p, tmp);\
}\
-}
+} while (0)