Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Feb 2013 09:32:43 +0000
From:      David Chisnall <theraven@FreeBSD.org>
To:        mdf@FreeBSD.org
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Giorgos Keramidas <keramida@FreeBSD.org>
Subject:   Re: svn commit: r247014 - head/lib/libc/stdlib
Message-ID:  <79B2F826-6CB5-4CD5-8C7D-8220833403EF@FreeBSD.org>
In-Reply-To: <CAMBSHm-ZPNAYj1tqs%2B8paYJgn69=zPe5O-tsn1dvn4t2156muA@mail.gmail.com>
References:  <201302192357.r1JNveLq039940@svn.freebsd.org> <CAMBSHm-ZPNAYj1tqs%2B8paYJgn69=zPe5O-tsn1dvn4t2156muA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 20 Feb 2013, at 08:25, mdf@FreeBSD.org wrote:

> These should be declared const int *.  And the cast shouldn't be
> needed in C, since void * can be assigned to any other pointer type.

In fact, the entire function body can be replaced with:

  return (*(int*)p1 - *(int*)p2);

qsort doesn't require that you return -1, 0, or 1, it requires you =
return <0, 0, or >0.

David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?79B2F826-6CB5-4CD5-8C7D-8220833403EF>