From: Ben Pfaff Date: Fri, 26 Apr 2013 20:00:32 +0000 (-0700) Subject: ofp-util: Make names[] in ofputil_action_code_from_name() const-ier. X-Git-Tag: sliver-openvswitch-1.10.90-3~16^2~42 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a00d4bd03640dff91d3d73a063b6dde91fe52cd1;p=sliver-openvswitch.git ofp-util: Make names[] in ofputil_action_code_from_name() const-ier. This changes allows the compiler to put 'names' in a read-only section. Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 42c361311..4d3fe9e4c 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -4235,7 +4235,7 @@ size_t ofputil_count_phy_ports(uint8_t ofp_version, struct ofpbuf *b) int ofputil_action_code_from_name(const char *name) { - static const char *names[OFPUTIL_N_ACTIONS] = { + static const char *const names[OFPUTIL_N_ACTIONS] = { NULL, #define OFPAT10_ACTION(ENUM, STRUCT, NAME) NAME, #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME, @@ -4243,7 +4243,7 @@ ofputil_action_code_from_name(const char *name) #include "ofp-util.def" }; - const char **p; + const char *const *p; for (p = names; p < &names[ARRAY_SIZE(names)]; p++) { if (*p && !strcasecmp(name, *p)) {