From: Andrey Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Subject: [PATCH] sort target list in grub-mkimage help output to make it easier to read
Date: Sat, 7 Dec 2013 17:27:53 +0400 [thread overview]
Message-ID: <1386422873-20547-1-git-send-email-arvidjaar@gmail.com> (raw)
---
util/mkimage.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/util/mkimage.c b/util/mkimage.c
index ad12f8a..94f7edb 100644
--- a/util/mkimage.c
+++ b/util/mkimage.c
@@ -959,21 +959,27 @@ grub_util_get_target_name (const struct grub_install_image_target_desc *t)
char *
grub_install_get_image_targets_string (void)
{
+ const char **arr = xmalloc (sizeof (char *) * ARRAY_SIZE (image_targets));
int format_len = 0;
char *formats;
char *ptr;
unsigned i;
for (i = 0; i < ARRAY_SIZE (image_targets); i++)
- format_len += strlen (image_targets[i].names[0]) + 2;
+ {
+ arr[i] = image_targets[i].names[0];
+ format_len += strlen (image_targets[i].names[0]) + 2;
+ }
ptr = formats = xmalloc (format_len);
+ qsort (arr, ARRAY_SIZE (image_targets), sizeof (char *), grub_qsort_strcmp);
for (i = 0; i < ARRAY_SIZE (image_targets); i++)
{
- strcpy (ptr, image_targets[i].names[0]);
- ptr += strlen (image_targets[i].names[0]);
+ strcpy (ptr, arr[i]);
+ ptr += strlen (arr[i]);
*ptr++ = ',';
*ptr++ = ' ';
}
ptr[-2] = 0;
+ free (arr);
return formats;
}
--
tg: (f585c90..) u/grub-mkimage-sort-targets (depends on: master)
next reply other threads:[~2013-12-07 13:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-07 13:27 Andrey Borzenkov [this message]
2013-12-09 23:49 ` [PATCH] sort target list in grub-mkimage help output to make it easier to read Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-10 10:52 ` Andrey Borzenkov
2014-04-03 18:14 ` Andrey Borzenkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386422873-20547-1-git-send-email-arvidjaar@gmail.com \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).