Cleanup: correct qsort comments

Also add link to original source & parenthesize min macro.
This commit is contained in:
Campbell Barton 2016-01-30 13:26:11 +11:00
parent 5f0b673aa9
commit 0e4e1993e6
Notes: blender-bot 2023-02-14 08:16:00 +01:00
Referenced by issue #47281, Blender crashes randomly on freshly installed windows 10 (OpenGL)
1 changed files with 8 additions and 5 deletions

View File

@ -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)
{