qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/3] i386: display known CPUID features linewrap


From: Eduardo Habkost
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
User-agent: Mutt/1.9.2 (2017-12-15)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]