]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
tools/kvm_stat: simplify the sortkey function
authorMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Tue, 9 Jan 2018 12:27:01 +0000 (13:27 +0100)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Thu, 12 Apr 2018 13:26:54 +0000 (10:26 -0300)
commit8f5b64d2040eb416a4270af91f2855d1c491359c
tree603aa900509b0b9af217f245902b54313f4501a9
parentef262fd8efa8cbcaa83ef85c0e1e87d6665ff681
tools/kvm_stat: simplify the sortkey function

BugLink: http://bugs.launchpad.net/bugs/1734130
The 'sortkey' function references a value in its enclosing
scope (closure). This is not common practice for a sort key function
so let's replace it. Additionally, the function 'sorted' has already a
parameter for reversing the result therefore the inversion of the
values is unneeded. The check for stats[x][1] is also superfluous as
it's ensured that this value is initialized with 0.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Tested-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit faa312a543283c717342cd332b5b9247bd305dce)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
tools/kvm/kvm_stat/kvm_stat