qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] introduce environment variables for all qemu-us


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] introduce environment variables for all qemu-user options
Date: Sun, 31 Jul 2011 13:12:02 +0100

On 31 July 2011 12:51,  <address@hidden> wrote:
> +    if ((r = getenv("QEMU_STACK_SIZE")) != NULL) {
> +        guest_stack_size = strtoul(r, (char **)&r, 0);
> +        if (guest_stack_size == 0)
> +            usage();
> +        if (*r == 'M')
> +            guest_stack_size *= 1024 * 1024;
> +        else if (*r == 'k' || *r == 'K')
> +            guest_stack_size *= 1024;
> +    }

[etc]

This is all basically duplicating the existing command line
argument parsing code, which (a) makes it very easy for the
two to drift out of sync in future and (b) means command line
options added in future might end up without a corresponding
environment variable.

I think it would be much nicer to have this be table-driven,
to avoid the code duplication. It ought to be possible to
derive most of the extra --help text from the table too.

-- PMM



reply via email to

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