Skip to contentSkip to conversation

tweak lookup_feature() in target-i386/cpu.c

PATCH In review Michael W. Bombardieri 2 participants 2 messages Mar 30, 2013 – Apr 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tweak lookup_feature() in target-i386/cpu.c

Hi,

The following patch removes variable 'found' from lookup_feature(). We can just return true/false (found/not found) directly. Does this look OK?

- Michael

target-i386/cpu.c +2 -3
index a0640db..9147aaf 100644
@@ -319,15 +319,14 @@ static bool lookup_feature(uint32_t *pval, const char *s, const char *e,
 {
     uint32_t mask;
     const char **ppc;
-    bool found = false;
 
     for (mask = 1, ppc = featureset; mask; mask <<= 1, ++ppc) {
         if (*ppc && !altcmp(s, e, *ppc)) {
             *pval |= mask;
-            found = true;
+            return true;
         }
     }
-    return found;
+    return false;
 }
 
 static void add_flagname_to_bitmaps(const char *flagname,
#1 lore raw
Quoted 5 lines · On Sat, 30 Mar 2013 10:01:21 +0800 "Michael W. Bombardieri" <[email protected]> wrote:

Hi,

The following patch removes variable 'found' from lookup_feature(). We can just return true/false (found/not found) directly. Does this look OK?

We are aiming to remove lookup_feature() and related feature tables, so touching it without adding/fixing something looks like unnecessary code movement.

Quoted 27 lines

- Michael

target-i386/cpu.c +2 -3
index a0640db..9147aaf 100644
@@ -319,15 +319,14 @@ static bool lookup_feature(uint32_t *pval, const char *s, const char *e,
 {
     uint32_t mask;
     const char **ppc;
-    bool found = false;
 
     for (mask = 1, ppc = featureset; mask; mask <<= 1, ++ppc) {
         if (*ppc && !altcmp(s, e, *ppc)) {
             *pval |= mask;
-            found = true;
+            return true;
         }
     }
-    return found;
+    return false;
 }
 
 static void add_flagname_to_bitmaps(const char *flagname,
Signature · 2 lines
Regards,
  Igor