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
thanks !
Daniel
--
Red Hat Virtualization group
http://redhat.com/virtualization/
Daniel Veillard | virtualization library
http://libvirt.org/
veillard(a)redhat.com | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine
http://rpmfind.net/