[Libvir] [PATCH] Fix the check of <cpumap> in virsh vcpupin

Richard W.M. Jones rjones at redhat.com
Mon Jun 18 13:15:59 UTC 2007

Daniel Veillard wrote:
> On Mon, Jun 18, 2007 at 12:02:01PM +0100, Richard W.M. Jones wrote:
>> <rant> It's 2007 - we should not be writing any more software in C. </rant>
>   You're right, I really need to write a javascript interpreter and
> embbed it in libxml2 so we can rewrite all the upper layers.

Nah, dynamic languages suck even more.  Particularly interpreted ones.

   let ids =
     try List.map int_of_string (String.nsplit cpulist ",")
     with Failure "int_of_string" ->
       raise (VirshError (cpulist ": invalid format"))

That's the same code (actually better - not only does it do the check, 
but it converts the CPU numbers to a list of integers for you), safer, 
the same speed as the C code, and a factor of 10 shorter.


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070618/675793de/attachment-0001.bin>

More information about the libvir-list mailing list