mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
Eliminate most shadowing for local variable names.
Shadowing is when a variable with a given name in an inner scope hides a different variable with the same name in a surrounding scope. This is generally undesirable because it can confuse programmers. This commit eliminates most of it. Found with -Wshadow=local in GCC 7. The repo is not really ready to enable this option by default because of a few cases that are harder to fix, and harmless, such as nested use of CMAP_FOR_EACH. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
This commit is contained in:
@@ -342,14 +342,13 @@ learn_parse_spec(const char *orig, char *name, char *value,
|
||||
name, value);
|
||||
}
|
||||
|
||||
char *error = learn_parse_load_immediate(&imm, dst_value + 2, value, spec,
|
||||
ofpacts);
|
||||
error = learn_parse_load_immediate(&imm, dst_value + 2, value, spec,
|
||||
ofpacts);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
} else {
|
||||
struct ofpact_reg_move move;
|
||||
char *error;
|
||||
|
||||
error = nxm_parse_reg_move(&move, value);
|
||||
if (error) {
|
||||
@@ -363,7 +362,7 @@ learn_parse_spec(const char *orig, char *name, char *value,
|
||||
spec->dst = move.dst;
|
||||
}
|
||||
} else if (!strcmp(name, "output")) {
|
||||
char *error = mf_parse_subfield(&spec->src, value);
|
||||
error = mf_parse_subfield(&spec->src, value);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
|
Reference in New Issue
Block a user