From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a706m-0003Hp-7D for qemu-devel@nongnu.org; Thu, 10 Dec 2015 07:14:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a706g-0003mk-Rl for qemu-devel@nongnu.org; Thu, 10 Dec 2015 07:14:04 -0500 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:55886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a706g-0003lc-Hv for qemu-devel@nongnu.org; Thu, 10 Dec 2015 07:13:58 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Dec 2015 12:13:56 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2F6A51B08078 for ; Thu, 10 Dec 2015 12:14:23 +0000 (GMT) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tBACDrkX11207040 for ; Thu, 10 Dec 2015 12:13:53 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tBACDrPF025047 for ; Thu, 10 Dec 2015 05:13:53 -0700 From: Janosch Frank Date: Thu, 10 Dec 2015 13:12:35 +0100 Message-Id: <1449749584-23214-6-git-send-email-frankja@linux.vnet.ibm.com> In-Reply-To: <1449749584-23214-1-git-send-email-frankja@linux.vnet.ibm.com> References: <1449749584-23214-1-git-send-email-frankja@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 05/34] scripts/kvm/kvm_stat: Mark globals in functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, frankja@linux.vnet.ibm.com Updating globals over the globals().update() method is not the standard way of changing globals. Marking variables as global and modifying them the standard way is better readable. --- scripts/kvm/kvm_stat | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index 7a8617d..83450be 100755 --- a/scripts/kvm/kvm_stat +++ b/scripts/kvm/kvm_stat @@ -237,31 +237,34 @@ IOCTL_NUMBERS = { } def x86_init(flag): - globals().update({ - 'SC_PERF_EVT_OPEN' : 298, - 'EXIT_REASONS' : X86_EXIT_REASONS[flag], - }) + global SC_PERF_EVT_OPEN + global EXIT_REASONS + + SC_PERF_EVT_OPEN = 298 + EXIT_REASONS = X86_EXIT_REASONS[flag] def s390_init(): - globals().update({ - 'SC_PERF_EVT_OPEN' : 331 - }) + global SC_PERF_EVT_OPEN + + SC_PERF_EVT_OPEN = 331 def ppc_init(): - globals().update({ - 'SC_PERF_EVT_OPEN' : 319, - 'IOCTL_NUMBERS' : { - 'SET_FILTER' : 0x80002406 | (ctypes.sizeof(ctypes.c_char_p) << 16), - 'ENABLE' : 0x20002400, - 'DISABLE' : 0x20002401, - } - }) + global SC_PERF_EVT_OPEN + global IOCTL_NUMBERS + + SC_PERF_EVT_OPEN = 319 + + IOCTL_NUMBERS['ENABLE'] = 0x20002400 + IOCTL_NUMBERS['DISABLE'] = 0x20002401 + IOCTL_NUMBERS['SET_FILTER'] = 0x80002406 | (ctypes.sizeof(ctypes.c_char_p) + << 16) def aarch64_init(): - globals().update({ - 'SC_PERF_EVT_OPEN' : 241, - 'EXIT_REASONS' : AARCH64_EXIT_REASONS, - }) + global SC_PERF_EVT_OPEN + global EXIT_REASONS + + SC_PERF_EVT_OPEN = 241 + EXIT_REASONS = AARCH64_EXIT_REASONS def detect_platform(): if os.uname()[4].startswith('ppc'): -- 2.3.0