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(-)
All looks good to me.
Rich.
--
Emerging Technologies, Red Hat -
http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903