On 01/12/2012 05:49 AM, Peter Krempa wrote:
On 01/12/2012 01:19 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange"<berrange(a)redhat.com>
>
> Domain IDs are at least 16 bits for most hypervisors, theoretically
> event 32-bits. 3 characters is clearly too small an alignment.
> Increase alignment to 10 characters to allow 32-bit domain IDs to
> display cleanly. Commonly seen with LXC where domain IDs are the
> process IDs by default. Also increase the 'name' field from 20
> to 30 characters to cope with longer guest names which are quite
> common
>
> In v2:
>
> - Increase size to 10 chars
> - Left align ID values
> - Also increase name field to 30
> - Increase number of '-' to compensate
>
> ---
I think that 10 characters is a lot of space wasted in most of cases :/.
What about calculating the alignment dynamicaly? I'm adding code to the
list command, so I could add that as a part of my patch.
A generic helper function for dynamically sizing columns would indeed be
nice, but I think that can be a follow up. It would require callers to
allocate a char*** - an array rows to be formatted, where each row is
represented by an array of columns.
I'm okay with Daniel's patch going in now, as it is a strict
improvement, even if we make further improvements down the road.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org