[Bf-blender-cvs] [0e4e199] master: Cleanup: correct qsort comments
Campbell Barton
noreply at git.blender.org
Sat Jan 30 03:35:37 CET 2016
Commit: 0e4e1993e619caad3dfbecc20ab9fb20cdf6cd06
Author: Campbell Barton
Date: Sat Jan 30 13:26:11 2016 +1100
Branches: master
https://developer.blender.org/rB0e4e1993e619caad3dfbecc20ab9fb20cdf6cd06
Cleanup: correct qsort comments
Also add link to original source & parenthesize min macro.
===================================================================
M source/blender/blenlib/intern/sort.c
===================================================================
diff --git a/source/blender/blenlib/intern/sort.c b/source/blender/blenlib/intern/sort.c
index 190c874..19fea87 100644
--- a/source/blender/blenlib/intern/sort.c
+++ b/source/blender/blenlib/intern/sort.c
@@ -44,12 +44,17 @@
# undef min
#endif
-/* note: modified to use glibc arg order for callback */
-/* **** qsort based on FreeBSD source (libkern\qsort.c) **** */
+/**
+ * qsort, copied from FreeBSD source.
+ * with only very minor edits, see:
+ * http://github.com/freebsd/freebsd/blob/master/sys/libkern/qsort.c
+ *
+ * \note modified to use glibc arg order for callbacks.
+ */
BLI_INLINE char *med3(char *, char *, char *, BLI_sort_cmp_t, void *);
BLI_INLINE void swapfunc(char *, char *, int, int);
-#define min(a, b) (a) < (b) ? a : b
+#define min(a, b) (a) < (b) ? (a) : (b)
#define swapcode(TYPE, parmi, parmj, n) \
{ \
long i = (n) / sizeof(TYPE); \
@@ -92,8 +97,6 @@ BLI_INLINE char *med3(char *a, char *b, char *c, BLI_sort_cmp_t cmp, void *thunk
/**
* Quick sort reentrant.
- *
- * \note Follows BSD arg order (incompatible with glibc).
*/
void BLI_qsort_r(void *a, size_t n, size_t es, BLI_sort_cmp_t cmp, void *thunk)
{
More information about the Bf-blender-cvs
mailing list