On Thu, Mar 18, 2010 at 04:04:32PM +0100, Jim Meyering wrote:
It probably doesn't matter, since this function is unlikely to be applied in an inner loop or to very long strings with lots of leading and trailing blanks, but...
You could write this function so that it reads the input string only once, rather than 2 or 3 times.
Thanks -- I've made some adjustments to this function. Speedwise it's not hugely important when you consider that we immediately dispatch the strings over an RPC-encoded loopback network socket. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html