On Mon, Jan 08, 2007 at 02:08:21AM +0100, Karel Zak wrote:
On Fri, Jan 05, 2007 at 09:16:54PM +0000, Daniel P. Berrange wrote:
> +static int qemudParseUUID(const char *uuid,
> + unsigned char *rawuuid) {
> + const char *cur;
> + int i;
> +
> + /*
> + * do a liberal scan allowing '-' and ' ' anywhere between
character
> + * pairs as long as there is 32 of them in the end.
> + */
> + cur = uuid;
> + for (i = 0;i < 16;) {
> + rawuuid[i] = 0;
> + if (*cur == 0)
> + goto error;
> + if ((*cur == '-') || (*cur == ' ')) {
> + cur++;
> + continue;
> + }
> + if ((*cur >= '0') && (*cur <= '9'))
isdigit() ? :-)
locale dependant so please no no no :-)
> + sprintf(memory, "%d", vm->def.memory/1024);
vm->def.memory >> 10
(professional deformation from BaseOS packages... :-)
I would avoid that too, less readable, harder to maintaine, and the
compiler is better at optimizing anyway.
> + while ((entry = readdir(dir))) {
> + char file[PATH_MAX];
> + if (entry->d_name[0] == '.')
> + continue;
is ".myconfig" forbidden filename? Otherwise:
honnestly I would avoid it, yes :-)
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/