From: Eduardo Habkost <ehabkost@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 3/3] i386: display known CPUID features linewrapped, in alphabetical order
Date: Mon, 11 Jun 2018 18:22:39 -0300 [thread overview]
Message-ID: <20180611212239.GB7451@localhost.localdomain> (raw)
In-Reply-To: <20180606165527.17365-4-berrange@redhat.com>
On Wed, Jun 06, 2018 at 05:55:27PM +0100, Daniel P. Berrangé wrote:
[...]
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index cb074082b3..8043e41be8 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -3157,17 +3157,21 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
>
> /* Print all cpuid feature names in featureset
> */
> -static void listflags(FILE *f, fprintf_function print, const char **featureset)
> +static void listflags(FILE *f, fprintf_function print, GList *features)
> {
> - int bit;
> - bool first = true;
> -
> - for (bit = 0; bit < 32; bit++) {
> - if (featureset[bit]) {
> - print(f, "%s%s", first ? "" : " ", featureset[bit]);
> - first = false;
> + size_t len = 0;
> + GList *tmp;
> +
> + for (tmp = features; tmp; tmp = tmp->next) {
> + const char *name = tmp->data;
> + if ((len + strlen(name) + 1) >= 75) {
> + print(f, "\n");
> + len = 0;
> }
> + print(f, "%s%s", len == 0 ? " " : " ", name);
> + len += strlen(name) + 1;
> }
> + print(f, "\n");
I'd love to have generic helper functions to format text like
this, but that's not a reason to block this patch from being
included. I will queue the series on x86-next. Thanks!
--
Eduardo
next prev parent reply other threads:[~2018-06-11 21:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-06 16:55 [Qemu-devel] [PATCH 0/3] i386: improve output from "-cpu help" argument Daniel P. Berrangé
2018-06-06 16:55 ` [Qemu-devel] [PATCH 1/3] i386: improve alignment of CPU model listing Daniel P. Berrangé
2018-06-06 16:55 ` [Qemu-devel] [PATCH 2/3] i386: improve sorting of CPU model names Daniel P. Berrangé
2018-06-06 16:55 ` [Qemu-devel] [PATCH 3/3] i386: display known CPUID features linewrapped, in alphabetical order Daniel P. Berrangé
2018-06-11 21:22 ` Eduardo Habkost [this message]
2018-06-11 21:23 ` [Qemu-devel] [PATCH 0/3] i386: improve output from "-cpu help" argument Eduardo Habkost
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=20180611212239.GB7451@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).