remove some variable shadowing
PATCH 2/2 seccomp: avoid shadowing of 'action' variable
In reply to Daniel P. BerrangéThis is confusing as one 'action' variable is used for storing a SCMP_ enum value, while the other 'action' variable is used for storing a SECCOMP_ enum value.
--- softmmu/qemu-seccomp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
softmmu/qemu-seccomp.c +2 -2
@@ -283,9 +283,9 @@ static uint32_t qemu_seccomp_update_action(uint32_t action)if (action ==SCMP_ACT_TRAP ) {static int kill_process =-1 ;if (kill_process ==-1 ) { -uint32_t action =SECCOMP_RET_KILL_PROCESS ; +uint32_t testaction =SECCOMP_RET_KILL_PROCESS ; -if (qemu_seccomp (SECCOMP_GET_ACTION_AVAIL ,0 , &action) ==0 ) { +if (qemu_seccomp (SECCOMP_GET_ACTION_AVAIL ,0 , &testaction) ==0 ) { kill_process =1 ; }else { kill_process =0 ;
Signature · 1 line
2.41.0
PATCH 1/2 crypto: remove shadowed 'ret' variable
In reply to Daniel P. BerrangéBoth instances of 'ret' are used to store a gnutls API return code.
--- crypto/tls-cipher-suites.c | 1 - 1 file changed, 1 deletion(-)
crypto/tls-cipher-suites.c +0 -1
@@ -52,7 +52,6 @@ GByteArray *qcrypto_tls_cipher_suites_get_data(QCryptoTLSCipherSuites *obj, byte_array =g_byte_array_new ();for (i =0 ;; i++) { -int ret;unsigned idx;const char *name;IANA_TLS_CIPHER cipher;
Signature · 1 line
2.41.0
cover remove some variable shadowing
Daniel P. Berrangé (2):
crypto: remove shadowed 'ret' variable
seccomp: avoid shadowing of 'action' variable
crypto/tls-cipher-suites.c | 1 - softmmu/qemu-seccomp.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.41.0
Re: [PATCH 1/2] crypto: remove shadowed 'ret' variable
In reply to Daniel P. BerrangéQuoted 6 lines · Daniel P. Berrangé
Both instances of 'ret' are used to store a gnutls API return code.
Signed-off-by Daniel P. Berrangé <[email protected]>--- crypto/tls-cipher-suites.c | 1 - 1 file changed, 1 deletion(-)
Re: [PATCH 2/2] seccomp: avoid shadowing of 'action' variable
In reply to Daniel P. BerrangéQuoted 15 lines · Daniel P. Berrangé
This is confusing as one 'action' variable is used for storing a
SCMP_enum value, while the other 'action' variable is used for storing aSECCOMP_enum value.Signed-off-by Daniel P. Berrangé <[email protected]>--- softmmu/qemu-seccomp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)softmmu/qemu-seccomp.c +0
-0@@ -283,9 +283,9 @@ static uint32_t qemu_seccomp_update_action(uint32_t action)if (action ==SCMP_ACT_TRAP ) {
softmmu/qemu-seccomp.c static uint32_t qemu_seccomp_update_action(uint32_t action) · line 291
Quoted 10 lines
softmmu/qemu-seccomp.c +2
-2static int kill_process =-1 ;if (kill_process ==-1 ) { -uint32_t action =SECCOMP_RET_KILL_PROCESS ; +uint32_t testaction =SECCOMP_RET_KILL_PROCESS ; -if (qemu_seccomp (SECCOMP_GET_ACTION_AVAIL ,0 , &action) ==0 ) { +if (qemu_seccomp (SECCOMP_GET_ACTION_AVAIL ,0 , &testaction) ==0 ) { kill_process =1 ; }else { kill_process =0 ;
I'd prefer @test_action. Regardless:
Markus Armbruster
AppliedQueued, thanks!