From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5TOn-00005e-Ed for qemu-devel@nongnu.org; Thu, 18 Jun 2015 02:34:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5TOj-0003wm-TU for qemu-devel@nongnu.org; Thu, 18 Jun 2015 02:34:05 -0400 Date: Thu, 18 Jun 2015 16:24:25 +1000 From: David Gibson Message-ID: <20150618062425.GA13352@voom.redhat.com> References: <1432749176-4781-1-git-send-email-armbru@redhat.com> <87twu8i2f9.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/0ZNML3L+nUf91nU" Content-Disposition: inline In-Reply-To: <87twu8i2f9.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de --/0ZNML3L+nUf91nU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 16, 2015 at 08:37:46AM +0200, Markus Armbruster wrote: > MAINTAINERS grew since I posted this patch, copy the new guy. Thanks, applied to spapr-next. >=20 > Markus Armbruster writes: >=20 > > Since we now require GLib 2.22+ (commit f40685c), we don't have to > > work around lack of g_hash_table_iter_init() & friends anymore. > > > > This reverts commit f8833a37c0c6b22ddd57b45e48cfb0f97dbd5af4. > > > > Signed-off-by: Markus Armbruster > > --- > > hw/ppc/spapr_pci.c | 28 +++++++++++----------------- > > 1 file changed, 11 insertions(+), 17 deletions(-) > > > > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > > index 05f4fac..e2b9e60 100644 > > --- a/hw/ppc/spapr_pci.c > > +++ b/hw/ppc/spapr_pci.c > > @@ -962,34 +962,28 @@ static const VMStateDescription vmstate_spapr_pci= _msi =3D { > > }, > > }; > > =20 > > -static void spapr_pci_fill_msi_devs(gpointer key, gpointer value, > > - gpointer opaque) > > -{ > > - sPAPRPHBState *sphb =3D opaque; > > - > > - sphb->msi_devs[sphb->msi_devs_num].key =3D *(uint32_t *)key; > > - sphb->msi_devs[sphb->msi_devs_num].value =3D *(spapr_pci_msi *)val= ue; > > - sphb->msi_devs_num++; > > -} > > - > > static void spapr_pci_pre_save(void *opaque) > > { > > sPAPRPHBState *sphb =3D opaque; > > - int msi_devs_num; > > + GHashTableIter iter; > > + gpointer key, value; > > + int i; > > =20 > > if (sphb->msi_devs) { > > g_free(sphb->msi_devs); > > sphb->msi_devs =3D NULL; > > } > > - sphb->msi_devs_num =3D 0; > > - msi_devs_num =3D g_hash_table_size(sphb->msi); > > - if (!msi_devs_num) { > > + sphb->msi_devs_num =3D g_hash_table_size(sphb->msi); > > + if (!sphb->msi_devs_num) { > > return; > > } > > - sphb->msi_devs =3D g_malloc(msi_devs_num * sizeof(spapr_pci_msi_mi= g)); > > + sphb->msi_devs =3D g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_= msi_mig)); > > =20 > > - g_hash_table_foreach(sphb->msi, spapr_pci_fill_msi_devs, sphb); > > - assert(sphb->msi_devs_num =3D=3D msi_devs_num); > > + g_hash_table_iter_init(&iter, sphb->msi); > > + for (i =3D 0; g_hash_table_iter_next(&iter, &key, &value); ++i) { > > + sphb->msi_devs[i].key =3D *(uint32_t *) key; > > + sphb->msi_devs[i].value =3D *(spapr_pci_msi *) value; > > + } > > } > > =20 > > static int spapr_pci_post_load(void *opaque, int version_id) >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --/0ZNML3L+nUf91nU Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVgmQZAAoJEGw4ysog2bOSWKYQAMDYzfBxIXbxxl7HxgHtUGpL C9dhkaKrH4XVe5bieDj3wSJvBBRDSSYmnlhVY7FmRaPI5GNxugwq8m0pWkvQ+C8U ybkPvrn+W1m1/7MGuqpt1pFlMsRQGuEP0b5JwYeXtdpYD91uW8+49Jw2/xtJQOCf yE8DTkhZWeQ/8KxWjQPtt/vakDemClNV81ZEC9kL7VHel7oCM4ivnwvmgwtRyT5R JwcAFORqVcpgB6ISg874EF1dZ/CSB6eQZVNo1PSf7rH1VaW25WgtsL2iXm04UlDK x0LgKwYH4q+qn6fw7ZDsLN2LpNh4qPplHQjIfSoFtbavAmd4lbEtTZvq4qsTvEEF kvdF4dVafUMKkL8HsFmonvV3bFbqrlRRprO/rdJhGVKKtuBZOQL0Yu/hKzM628Dh RVEW7ou7DYXZ2LwMiS+crEkKP9ZVS5+roZ3eIUvWHmugUvJzzWjs7CNyf62W1GKy XuTuju87J+ivE6/14lOWZeDdfmkTcq6FdkGwz1Il4pSuVkCXddJSunly/M7SRAdm giTsxpDLKBEfNBRCJ+77yl29nFZkHXIozenT0lw2nsBv44madbpkjHE3vJY2/N0h 80d4AJjAccWi344IQDo3RtJjglWkDtvSvWgzeE0XjYQKcPmAIaMyFZhU1q+TmuAM xuPEPYnlr0kbSyhQkCAL =3B0b -----END PGP SIGNATURE----- --/0ZNML3L+nUf91nU--