[ovs-dev] [PATCH v5 1/6] lib/ofp-actions: improve ofpact_instruction_name_from_type()

Isaku Yamahata yamahata at valinux.co.jp
Tue Aug 28 17:19:00 UTC 2012


eliminate unnecessary loop.

Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>
---
v5
- newly introduced
---
 lib/ofp-actions.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 0e8b9da..baa6fdd 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -770,13 +770,7 @@ OVS_INSTRUCTIONS
 const char *
 ofpact_instruction_name_from_type(enum ovs_instruction_type type)
 {
-    const struct instruction_type_info *p;
-    for (p = inst_info; p < &inst_info[ARRAY_SIZE(inst_info)]; p++) {
-        if (p->type == type) {
-            return p->name;
-        }
-    }
-    return NULL;
+    return inst_info[type].name;
 }
 
 int
-- 
1.7.1.1




More information about the dev mailing list