|
@ -29,9 +29,9 @@ |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" SUCH DAMAGE. |
|
|
.\" SUCH DAMAGE. |
|
|
.\" |
|
|
.\" |
|
|
.\" $OpenBSD: qsort.3,v 1.22 2019/01/21 20:43:27 tedu Exp $ |
|
|
|
|
|
|
|
|
.\" $OpenBSD: qsort.3,v 1.23 2019/01/22 06:44:46 otto Exp $ |
|
|
.\" |
|
|
.\" |
|
|
.Dd $Mdocdate: January 21 2019 $ |
|
|
|
|
|
|
|
|
.Dd $Mdocdate: January 22 2019 $ |
|
|
.Dt QSORT 3 |
|
|
.Dt QSORT 3 |
|
|
.Os |
|
|
.Os |
|
|
.Sh NAME |
|
|
.Sh NAME |
|
@ -188,8 +188,8 @@ cmp(const void *a, const void *b) |
|
|
size_t lena = strlen(*(const char **)a); |
|
|
size_t lena = strlen(*(const char **)a); |
|
|
size_t lenb = strlen(*(const char **)b); |
|
|
size_t lenb = strlen(*(const char **)b); |
|
|
/* |
|
|
/* |
|
|
* Do not subtract the lengths. The difference between values cannot |
|
|
|
|
|
* be represented by an int. |
|
|
|
|
|
|
|
|
* Do not subtract the lengths. The difference between values |
|
|
|
|
|
* cannot be represented by an int. |
|
|
*/ |
|
|
*/ |
|
|
return lena < lenb ? -1 : lena > lenb; |
|
|
return lena < lenb ? -1 : lena > lenb; |
|
|
} |
|
|
} |
|
|