lib/ofp-actions: improve ofpact_instruction_name_from_type()
authorIsaku Yamahata <yamahata@valinux.co.jp>
Tue, 28 Aug 2012 17:19:00 +0000 (02:19 +0900)
committerBen Pfaff <blp@nicira.com>
Tue, 28 Aug 2012 18:02:10 +0000 (11:02 -0700)
eliminate unnecessary loop.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-actions.c

index 0e8b9dac42ad4e37a2d5b22d7353d301f7058b9a..baa6fdd7f5c27578b74f9cfc8a243eac6a541b13 100644 (file)
@@ -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