diff options
author | Ben Pfaff <blp@nicira.com> | 2010-09-02 10:09:09 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-09-20 09:39:54 -0700 |
commit | 2a022368f4b37559de5d5621a88c648023493f75 (patch) | |
tree | bfb5291578273782b71ad2d5fbdb72744e94d857 /lib/netlink.c | |
parent | 1089aab7136612acb86cdcd638d7d2261311531a (diff) |
Avoid shadowing local variable names.
All of these changes avoid using the same name for two local variables
within a same function. None of them are actual bugs as far as I can tell,
but any of them could be confusing to the casual reader.
The one in lib/ovsdb-idl.c is particularly brilliant: inner and outer
loops both using (different) variables named 'i'.
Found with GCC -Wshadow.
Diffstat (limited to 'lib/netlink.c')
-rw-r--r-- | lib/netlink.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/netlink.c b/lib/netlink.c index 4e83747c..66c27b1f 100644 --- a/lib/netlink.c +++ b/lib/netlink.c @@ -1036,19 +1036,19 @@ nl_policy_parse(const struct ofpbuf *msg, size_t nla_offset, type = nla->nla_type; if (type < n_attrs && policy[type].type != NL_A_NO_ATTR) { - const struct nl_policy *p = &policy[type]; + const struct nl_policy *e = &policy[type]; size_t min_len, max_len; /* Validate length and content. */ - min_len = p->min_len ? p->min_len : attr_len_range[p->type][0]; - max_len = p->max_len ? p->max_len : attr_len_range[p->type][1]; + min_len = e->min_len ? e->min_len : attr_len_range[e->type][0]; + max_len = e->max_len ? e->max_len : attr_len_range[e->type][1]; if (len < min_len || len > max_len) { VLOG_DBG_RL(&rl, "%zu: attr %"PRIu16" length %zu not in " "allowed range %zu...%zu", offset, type, len, min_len, max_len); return false; } - if (p->type == NL_A_STRING) { + if (e->type == NL_A_STRING) { if (((char *) nla)[nla->nla_len - 1]) { VLOG_DBG_RL(&rl, "%zu: attr %"PRIu16" lacks null at end", offset, type); @@ -1060,7 +1060,7 @@ nl_policy_parse(const struct ofpbuf *msg, size_t nla_offset, return false; } } - if (!p->optional && attrs[type] == NULL) { + if (!e->optional && attrs[type] == NULL) { assert(n_required > 0); --n_required; } |