Patchwork [04/16] linux-user: remove unnecessary local from __get_user(), __put_user()

login
register
mail settings
Submitter Riku@afflict.kos.to, Voipio@afflict.kos.to
Date Dec. 3, 2010, 1:36 p.m.
Message ID <bee70008074570ef2c368aec80918c2494065247.1291382447.git.riku.voipio@nokia.com>
Download mbox | patch
Permalink /patch/74145/
State New
Headers show

Comments

From: Peter Maydell <peter.maydell@linaro.org>

Remove an unnecessary local variable from the __get_user() and
__put_user() macros. This avoids confusing compilation failures
if the name of the local variable ('size') happens to be the
same as the variable the macro user is trying to read/write.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
---
 linux-user/qemu.h |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Patch

diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 00c6549..e66a02b 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -264,8 +264,7 @@  static inline int access_ok(int type, abi_ulong addr, abi_ulong size)
  */
 #define __put_user(x, hptr)\
 ({\
-    int size = sizeof(*hptr);\
-    switch(size) {\
+    switch(sizeof(*hptr)) {\
     case 1:\
         *(uint8_t *)(hptr) = (uint8_t)(typeof(*hptr))(x);\
         break;\
@@ -286,8 +285,7 @@  static inline int access_ok(int type, abi_ulong addr, abi_ulong size)
 
 #define __get_user(x, hptr) \
 ({\
-    int size = sizeof(*hptr);\
-    switch(size) {\
+    switch(sizeof(*hptr)) {\
     case 1:\
         x = (typeof(*hptr))*(uint8_t *)(hptr);\
         break;\