From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMeDL-000116-Dj for qemu-devel@nongnu.org; Wed, 27 Aug 2014 10:28:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMeDF-0008Qk-Ko for qemu-devel@nongnu.org; Wed, 27 Aug 2014 10:28:43 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:38727 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMeDF-0008QW-Dm for qemu-devel@nongnu.org; Wed, 27 Aug 2014 10:28:37 -0400 Date: Wed, 27 Aug 2014 16:27:49 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140827142749.GF31176@irqsave.net> References: <1409137736-827-1-git-send-email-stefanha@redhat.com> <1409137736-827-7-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1409137736-827-7-git-send-email-stefanha@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 6/6] Revert "qemu-img: sort block formats in help message" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Peter Maydell , Riku Voipio , qemu-devel@nongnu.org, Markus Armbruster , Gerd Hoffmann , Andreas Faerber The Wednesday 27 Aug 2014 =E0 12:08:56 (+0100), Stefan Hajnoczi wrote : > This reverts commit 1a443c1b8b4314d365e82bddeb1de5b4b1c15fb3 and the > later commit 395071a76328189f50c778f4dee6dabb90503dd9. >=20 > GSequence was introduced in glib 2.14. RHEL 5 fails to compile since i= t > uses glib 2.12.3. >=20 > Now that bdrv_iterate_format() invokes the iteration callback in sorted > order these commits are unnecessary. >=20 > Signed-off-by: Stefan Hajnoczi > --- > qemu-img.c | 25 +++---------------------- > 1 file changed, 3 insertions(+), 22 deletions(-) >=20 > diff --git a/qemu-img.c b/qemu-img.c > index c843420..2052b14 100644 > --- a/qemu-img.c > +++ b/qemu-img.c > @@ -32,7 +32,6 @@ > #include "block/block_int.h" > #include "block/qapi.h" > #include > -#include > =20 > #define QEMU_IMG_VERSION "qemu-img version " QEMU_VERSION \ > ", Copyright (c) 2004-2008 Fabrice Bellard\n= " > @@ -56,22 +55,9 @@ typedef enum OutputFormat { > #define BDRV_O_FLAGS BDRV_O_CACHE_WB > #define BDRV_DEFAULT_CACHE "writeback" > =20 > -static gint compare_data(gconstpointer a, gconstpointer b, gpointer us= er) > +static void format_print(void *opaque, const char *name) > { > - return g_strcmp0(a, b); > -} > - > -static void print_format(gpointer data, gpointer user) > -{ > - printf(" %s", (char *)data); > -} > - > -static void add_format_to_seq(void *opaque, const char *fmt_name) > -{ > - GSequence *seq =3D opaque; > - > - g_sequence_insert_sorted(seq, (gpointer)fmt_name, > - compare_data, NULL); > + printf(" %s", name); > } > =20 > static void QEMU_NORETURN GCC_FMT_ATTR(1, 2) error_exit(const char *fm= t, ...) > @@ -157,15 +143,10 @@ static void QEMU_NORETURN help(void) > " '-f' first image format\n" > " '-F' second image format\n" > " '-s' run in Strict mode - fail on different image size o= r sector allocation\n"; > - GSequence *seq; > =20 > printf("%s\nSupported formats:", help_msg); > - seq =3D g_sequence_new(NULL); > - bdrv_iterate_format(add_format_to_seq, seq); > - g_sequence_foreach(seq, print_format, NULL); > + bdrv_iterate_format(format_print, NULL); > printf("\n"); > - g_sequence_free(seq); > - > exit(EXIT_SUCCESS); > } > =20 > --=20 > 1.9.3 >=20 >=20 Reviewed-by: Beno=EEt Canet