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>2016-01-30 05:26:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-01-30 05:27:48 +0300
commit0e4e1993e619caad3dfbecc20ab9fb20cdf6cd06 (patch)
tree1afa79af7d1cf754c274ea6e58b5db91e0852f0e /source/blender/blenlib/intern/sort.c
parent5f0b673aa950bd268841ca11bb7da01458b985e1 (diff)
Cleanup: correct qsort comments
Also add link to original source & parenthesize min macro.
Diffstat (limited to 'source/blender/blenlib/intern/sort.c')
-rw-r--r--source/blender/blenlib/intern/sort.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/sort.c b/source/blender/blenlib/intern/sort.c
index 190c874e1b5..19fea87fb41 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)
{