libc/qsprt: Fix typo calculating nj - scc - simple c99 compiler
HTML git clone git://git.simple-cc.org/scc
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit d96e3eb8b442d7a67846161f37e368d5a64b95b2
DIR parent 67dc80bf14ef15162fa94ded320c7a338a330267
HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 1 May 2026 21:47:04 +0200
libc/qsprt: Fix typo calculating nj
The variable nj was using nj that was not initialized
and it should be ni, because nj is just the amount of
space after removing the ni elements.
Diffstat:
M src/libc/stdlib/qsort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
DIR diff --git a/src/libc/stdlib/qsort.c b/src/libc/stdlib/qsort.c
@@ -59,7 +59,7 @@ xqsort(unsigned char *a, size_t n, struct qsort *qs)
pi = a;
ni = (pj - a) / es;
pj += es;
- nj = n-nj-1;
+ nj = n-ni-1;
if (ni < nj) {
xqsort(pi, ni, qs);