aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2014-08-27 12:08:56 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2014-08-28 13:42:25 +0100
commit00c6d403a3ac303ebdcb1706ee983e13ba8e2d5f (patch)
tree62b72d3875c069a7fbdf9a8e3da0aa700c7ea0a6 /qemu-img.c
parentada4240103470371533967334cda9965854fcbda (diff)
Revert "qemu-img: sort block formats in help message"
This reverts commit 1a443c1b8b4314d365e82bddeb1de5b4b1c15fb3 and the later commit 395071a76328189f50c778f4dee6dabb90503dd9. GSequence was introduced in glib 2.14. RHEL 5 fails to compile since it uses glib 2.12.3. Now that bdrv_iterate_format() invokes the iteration callback in sorted order these commits are unnecessary. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: BenoƮt Canet <benoit.canet@nodalink.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/qemu-img.c b/qemu-img.c
index c8434206b8..2052b14b84 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -32,7 +32,6 @@
#include "block/block_int.h"
#include "block/qapi.h"
#include <getopt.h>
-#include <glib.h>
#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"
-static gint compare_data(gconstpointer a, gconstpointer b, gpointer user)
+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 = opaque;
-
- g_sequence_insert_sorted(seq, (gpointer)fmt_name,
- compare_data, NULL);
+ printf(" %s", name);
}
static void QEMU_NORETURN GCC_FMT_ATTR(1, 2) error_exit(const char *fmt, ...)
@@ -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 or sector allocation\n";
- GSequence *seq;
printf("%s\nSupported formats:", help_msg);
- seq = 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);
}