From a00d4bd03640dff91d3d73a063b6dde91fe52cd1 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 26 Apr 2013 13:00:32 -0700 Subject: [PATCH] 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 --- lib/ofp-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)) { -- 2.47.0