[libvirt PATCH 03/19] commandhelper: Simplify envsort

Peter Krempa pkrempa at redhat.com
Fri Jan 29 16:50:39 UTC 2021


On Fri, Jan 29, 2021 at 17:16:13 +0100, Tim Wiederhake wrote:
> Comparing only the keys produces the same result as comparing keys and
> value. The latter saves two invocations of each `strndup` and `free`.

env variable names allow also ascii chars with lower index than '=' such
as numbers:

$ TEST=asdf TEST1=asdf env | grep TEST | LANG=C sort
TEST1=asdf
TEST=asdf
$ TEST=asdf TEST1=asdf env | grep TEST | cut -d "=" -f 1 | LANG=C sort
TEST
TEST1




More information about the libvir-list mailing list