[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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.

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

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]