From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEdkj-0001CM-8P for qemu-devel@nongnu.org; Tue, 05 Aug 2014 08:22:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEdke-0003KW-N0 for qemu-devel@nongnu.org; Tue, 05 Aug 2014 08:22:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEdke-0003KL-D4 for qemu-devel@nongnu.org; Tue, 05 Aug 2014 08:22:00 -0400 Message-ID: <53E0CC63.5070602@redhat.com> Date: Tue, 05 Aug 2014 06:21:55 -0600 From: Eric Blake MIME-Version: 1.0 References: <1407209598-2572-1-git-send-email-ming.lei@canonical.com> <1407209598-2572-2-git-send-email-ming.lei@canonical.com> <53E0C645.5050106@redhat.com> <20140805120537.GB13367@redhat.com> In-Reply-To: <20140805120537.GB13367@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aQcip0Qp7fmkCuEewmaq1gsMO2vOQmqAw" Subject: Re: [Qemu-devel] [PATCH v1 01/17] qemu/obj_pool.h: introduce object allocation pool List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Kevin Wolf , Peter Maydell , Fam Zheng , Ming Lei , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --aQcip0Qp7fmkCuEewmaq1gsMO2vOQmqAw Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/05/2014 06:05 AM, Michael S. Tsirkin wrote: > On Tue, Aug 05, 2014 at 05:55:49AM -0600, Eric Blake wrote: >> On 08/04/2014 09:33 PM, Ming Lei wrote: >>> This patch introduces object allocation pool for speeding up >>> object allocation in fast path. >>> >>> Signed-off-by: Ming Lei >>> --- >>> include/qemu/obj_pool.h | 64 +++++++++++++++++++++++++++++++++++++= ++++++++++ >>> 1 file changed, 64 insertions(+) >>> create mode 100644 include/qemu/obj_pool.h >>> >>> + >>> + char *objs; >>> +} ObjPool; >>> + >>> +static inline void obj_pool_init(ObjPool *op, void *objs_buf, void *= *free_objs, >>> + unsigned int obj_size, unsigned cnt= ) >>> +{ >>> + int i; >>> + >>> + op->objs =3D (char *)objs_buf; >> >> Why the cast? This is C, not C++. >=20 > It's not needed in C++ either, right? In C++, going from void* to a typed pointer requires a cast (that's why in C++ you see casts on malloc results). In C, void* can implicitly be converted to any other pointer (modulo const-/volatile-correctness). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --aQcip0Qp7fmkCuEewmaq1gsMO2vOQmqAw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJT4MxjAAoJEKeha0olJ0NqL2YH/2re3lzr6UNrpCJx/swr2CVp eqrfDIijn3KimsAyqOgZgzKobIadfsbfX1CrEnHTtiAxKbrmdXH90WTkEffdmY5A 9DiPphSzbW3uZmzKrJN4ZuLoLXm4PvJ6zAr3bkueuIm/3EX+ZUG5eWZbJv6XDxG/ ZRGAjZoooF+roXxCVbfoYgfpiGAqh1azuwrBemH7se+oZUXmDoxT2vFPTLFY/eOF i0wBKOJ2RGkEnHYLt4JNsIBZM6i7NFGWJRkIP8je0UFlonJzjRXXEpO66H9GAAij L1FMpfru9t3+NAaQ4yTDF5j0ImRBjlU9oEv7cWRDFVYZ4pb1UtjbS4Vp1g0owLk= =cz2b -----END PGP SIGNATURE----- --aQcip0Qp7fmkCuEewmaq1gsMO2vOQmqAw--