From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 03 of 10 [RFC]] libxc, libxl: Introduce xc_nodemap_t and libxl_nodemap Date: Wed, 11 Apr 2012 18:57:56 +0200 Message-ID: <1334163476.4298.13.camel@Solace> References: <2077d51764e0ff1e33a9.1334150270@Solace> <4F85B3A1.6030407@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4861366389204197605==" Return-path: In-Reply-To: <4F85B3A1.6030407@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: Andre Przywara , Ian Campbell , Stefano Stabellini , Juergen Gross , Ian Jackson , "xen-devel@lists.xen.org" , Jan Beulich List-Id: xen-devel@lists.xenproject.org --===============4861366389204197605== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-wDjTQQhOKGo3CnD563Dr" --=-wDjTQQhOKGo3CnD563Dr Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2012-04-11 at 17:38 +0100, George Dunlap wrote: > > - sz =3D xc_get_cpumap_size(xch); > > +/* XXX See [*] below ... */ > > +static xc_cpumap_t __xc_map_alloc(xc_interface *xch, int sz) > > +{ > > if (sz =3D=3D 0) > > return NULL; > > return calloc(1, sz); > > } > > > > +xc_cpumap_t xc_cpumap_alloc(xc_interface *xch) > > +{ > > + return __xc_map_alloc(xch, xc_get_cpumap_size(xch)); > > +} > > + > > +xc_nodemap_t xc_nodemap_alloc(xc_interface *xch) > > +{ > > + /* XXX [*] How bad is this? Ideas? */ > > + return (xc_nodemap_t) __xc_map_alloc(xch, xc_get_nodemap_size(xch)= ); > > +} > > + > I don't think it's incredibly terrible if it would buy us something; but= =20 > I don't really see that it does. =20 > Fine. :-) > Two functions would be a lot more=20 > readable, IMHO. >=20 I'm not entirely sure I see what you mean with "two functions". The main issue here is __xc_map_alloc returning an xc_cpumap_t. BTW, reading your comment it came to my mind that something like the below (removing __xc_map_alloc, which after all, is very small!) would be better... Was it this what you had in mind when talking about two functions? xc_cpumap_t xc_cpumap_alloc(xc_interface *xch) { if (sz =3D=3D 0) return NULL; return calloc(1, sz); } xc_nodemap_t xc_nodemap_alloc(xc_interface *xch) { if (sz =3D=3D 0) return NULL; return calloc(1, sz); } > Other than that, looks fine. > Thanks for looking into this so quickly! :-P Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-wDjTQQhOKGo3CnD563Dr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEABECAAYFAk+FuBQACgkQk4XaBE3IOsTA/wCgosdXq90saF30WEkd5TguOtiC 6CEAn1GDQDx3ckbuo3bIsEt88t1NNRYT =w3DM -----END PGP SIGNATURE----- --=-wDjTQQhOKGo3CnD563Dr-- --===============4861366389204197605== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============4861366389204197605==--