public
/
ack.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bc83231
)
fixed qsort() for 0 elements
author
eck
<none@none>
Tue, 28 Aug 1990 14:03:24 +0000
(14:03 +0000)
committer
eck
<none@none>
Tue, 28 Aug 1990 14:03:24 +0000
(14:03 +0000)
lang/cem/libcc.ansi/stdlib/qsort.c
patch
|
blob
|
history
diff --git
a/lang/cem/libcc.ansi/stdlib/qsort.c
b/lang/cem/libcc.ansi/stdlib/qsort.c
index
765252a
..
c9b2d33
100644
(file)
--- a/
lang/cem/libcc.ansi/stdlib/qsort.c
+++ b/
lang/cem/libcc.ansi/stdlib/qsort.c
@@
-15,6
+15,8
@@
void
qsort(void *base, size_t nel, size_t width,
int (*compar)(const void *, const void *))
{
+ /* when nel is 0, the expression '(nel - 1) * width' is wrong */
+ if (!nel) return;
qcompar = (int (*)(const char *, const char *)) compar;
qsort1(base, (char *)base + (nel - 1) * width, width);
}