projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix incorrect (and conflicting on LP64 archs) types for sysv ipc msgq functions
[musl]
/
src
/
stdlib
/
qsort.c
diff --git
a/src/stdlib/qsort.c
b/src/stdlib/qsort.c
index
f5bf3d0
..
91a3361
100644
(file)
--- a/
src/stdlib/qsort.c
+++ b/
src/stdlib/qsort.c
@@
-28,7
+28,7
@@
static void sift(char *base, size_t root, size_t nel, size_t width, int (*cmp)(c
max = 2*root;
if (max < nel && cmp(base+max*width, base+(max+1)*width) < 0)
max++;
max = 2*root;
if (max < nel && cmp(base+max*width, base+(max+1)*width) < 0)
max++;
- if (cmp(base+root*width, base+max*width) < 0) {
+ if (
max &&
cmp(base+root*width, base+max*width) < 0) {
swap(base+root*width, base+max*width, width);
root = max;
} else break;
swap(base+root*width, base+max*width, width);
root = max;
} else break;