Skip to contentSkip to conversation

Target-ppc: Remove unnecessary variable

PATCH Applied Shraddha Barke 2 participants 2 messages Sep 5, 2015 – Sep 6, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Target-ppc: Remove unnecessary variable

Compress lines and remove the variable ret.

Change made using Coccinelle script

@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;
@@
local idexpression ret;
expression e;
@@
- ret = e;
- return ret;
+ return e;
@@
type T; identifier i;
@@
- T i;
... when != i

---
 target-ppc/translate_init.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
target-ppc/translate_init.c +2 -7
index 16d7b16..b541473 100644
@@ -8577,11 +8577,7 @@ static int register_ind_insn (opc_handler_t **ppc_opcodes,
                               unsigned char idx1, unsigned char idx2,
                               opc_handler_t *handler)
 {
-    int ret;
-
-    ret = register_ind_in_table(ppc_opcodes, idx1, idx2, handler);
-
-    return ret;
+    return register_ind_in_table(ppc_opcodes, idx1, idx2, handler);
 }
 
 static int register_dblind_insn (opc_handler_t **ppc_opcodes,
@@ -9350,8 +9346,7 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name)
                 break;
         }
         if (i == 8) {
-            ret = OBJECT_CLASS(ppc_cpu_class_by_pvr(strtoul(name, NULL, 16)));
-            return ret;
+            return OBJECT_CLASS(ppc_cpu_class_by_pvr(strtoul(name, NULL, 16)));
         }
     }
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 1 line · Shraddha Barke

Compress lines and remove the variable ret.

Applied to -trivial, thanks!

/mjt