On Thu, Aug 09, 2007 at 09:18:02AM -0400, Daniel Veillard wrote:
On Wed, Aug 08, 2007 at 10:03:53PM +0100, Daniel P. Berrange wrote:
> Browsing the source I noticed we have many differents constants for UUID
> length, many ways of turning a UUID into a string, 2 ways of turning a
> string into a UUID (one with some scary signed <-> unsigned casting).
> This is just a result of the way the code evolved & I figured it could do
> with cleaning up a little.
>
> So I added a virUUIDFormat(const unsigned char uuid, char *uuidstr) method
> to the uuid.c, removed all the other equivalent code throughout and kiled
> all the duplicate constants. So now everything UUID related is in the one
> place uuid.c, while the constants are in libvirt/libvirt.h
>
> Its a surprisingly big patch, but it should not have any functional change
> with one exception. The XenD driver used to generate XML
<uuid>...</uuid>
> tags without any '-' embedded in them. All other places use the '-'
and
> technically the RFC requires them. Our parser is flexible enough to cope
> with, or without '-'.
>
> diffstat ~/libvirt-uuid-cleanup.patch
> proxy/Makefile.am | 2 -
> qemud/internal.h | 2 -
> src/libvirt.c | 34 +++-------------------------
> src/openvz_conf.c | 14 +++++------
> src/openvz_conf.h | 3 --
> src/qemu_conf.c | 20 ++++++----------
> src/qemu_conf.h | 5 +---
> src/test.c | 18 +++++----------
> src/uuid.c | 57 +++++++++++++++++++++++++++++++++--------------
> src/uuid.h | 13 ++++------
> src/xend_internal.c | 62 +++++++++++++++++++---------------------------------
> src/xm_internal.c | 31 +++++---------------------
> src/xml.c | 61 ---------------------------------------------------
> src/xml.h | 1
> 14 files changed, 104 insertions(+), 219 deletions(-)
yup, touches far more than I would have expected, good cleanup, +1
Ok, checked this in now.
Regards,
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules:
http://search.cpan.org/~danberr/ -=|
|=- Projects:
http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|