forked from Mirror/frr
lib vtysh zebra: variable shadowing fixes
Signed-off-by: F. Aragon <paco@voltanet.io>
This commit is contained in:
parent
88f47ef365
commit
c683bd446c
|
@ -445,7 +445,6 @@ in one shot. */
|
||||||
|
|
||||||
/* Free printed buffer data. */
|
/* Free printed buffer data. */
|
||||||
while (written > 0) {
|
while (written > 0) {
|
||||||
struct buffer_data *d;
|
|
||||||
if (!(d = b->head)) {
|
if (!(d = b->head)) {
|
||||||
flog_err(
|
flog_err(
|
||||||
LIB_ERR_DEVELOPMENT,
|
LIB_ERR_DEVELOPMENT,
|
||||||
|
|
|
@ -195,7 +195,7 @@ static enum matcher_rv command_match_r(struct graph_node *start, vector vline,
|
||||||
enum matcher_rv status = MATCHER_NO_MATCH;
|
enum matcher_rv status = MATCHER_NO_MATCH;
|
||||||
|
|
||||||
// get the minimum match level that can count as a full match
|
// get the minimum match level that can count as a full match
|
||||||
struct cmd_token *token = start->data;
|
struct cmd_token *copy, *token = start->data;
|
||||||
enum match_type minmatch = min_match_level(token->type);
|
enum match_type minmatch = min_match_level(token->type);
|
||||||
|
|
||||||
/* check history/stack of tokens
|
/* check history/stack of tokens
|
||||||
|
@ -326,8 +326,8 @@ static enum matcher_rv command_match_r(struct graph_node *start, vector vline,
|
||||||
}
|
}
|
||||||
if (*currbest) {
|
if (*currbest) {
|
||||||
// copy token, set arg and prepend to currbest
|
// copy token, set arg and prepend to currbest
|
||||||
struct cmd_token *token = start->data;
|
token = start->data;
|
||||||
struct cmd_token *copy = cmd_token_dup(token);
|
copy = cmd_token_dup(token);
|
||||||
copy->arg = XSTRDUP(MTYPE_CMD_ARG, input_token);
|
copy->arg = XSTRDUP(MTYPE_CMD_ARG, input_token);
|
||||||
listnode_add_before(*currbest, (*currbest)->head, copy);
|
listnode_add_before(*currbest, (*currbest)->head, copy);
|
||||||
} else if (n + 1 == vector_active(vline) && status == MATCHER_NO_MATCH)
|
} else if (n + 1 == vector_active(vline) && status == MATCHER_NO_MATCH)
|
||||||
|
|
|
@ -315,7 +315,7 @@ static void cmd_graph_permute(struct list *out, struct graph_node **stack,
|
||||||
struct graph_node *gn = stack[stackpos];
|
struct graph_node *gn = stack[stackpos];
|
||||||
struct cmd_token *tok = gn->data;
|
struct cmd_token *tok = gn->data;
|
||||||
char *appendp = cmd + strlen(cmd);
|
char *appendp = cmd + strlen(cmd);
|
||||||
size_t i, j;
|
size_t j;
|
||||||
|
|
||||||
if (tok->type < SPECIAL_TKN) {
|
if (tok->type < SPECIAL_TKN) {
|
||||||
sprintf(appendp, "%s ", tok->text);
|
sprintf(appendp, "%s ", tok->text);
|
||||||
|
@ -332,7 +332,7 @@ static void cmd_graph_permute(struct list *out, struct graph_node **stack,
|
||||||
if (++stackpos == CMD_ARGC_MAX)
|
if (++stackpos == CMD_ARGC_MAX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < vector_active(gn->to); i++) {
|
for (size_t i = 0; i < vector_active(gn->to); i++) {
|
||||||
struct graph_node *gnext = vector_slot(gn->to, i);
|
struct graph_node *gnext = vector_slot(gn->to, i);
|
||||||
for (j = 0; j < stackpos; j++)
|
for (j = 0; j < stackpos; j++)
|
||||||
if (stack[j] == gnext)
|
if (stack[j] == gnext)
|
||||||
|
|
|
@ -318,8 +318,8 @@ void list_sort(struct list *list, int (*cmp)(const void **, const void **))
|
||||||
|
|
||||||
qsort(items, n, sizeof(void *), realcmp);
|
qsort(items, n, sizeof(void *), realcmp);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < n; ++i)
|
for (unsigned int j = 0; j < n; ++j)
|
||||||
listnode_add(list, items[i]);
|
listnode_add(list, items[j]);
|
||||||
|
|
||||||
XFREE(MTYPE_TMP, items);
|
XFREE(MTYPE_TMP, items);
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,7 +395,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
|
||||||
memcpy(&buf[pos], left, lsize);
|
memcpy(&buf[pos], left, lsize);
|
||||||
pos += lsize;
|
pos += lsize;
|
||||||
|
|
||||||
for (size_t i = 0; i < width - lsize - rsize; i++)
|
for (size_t l = 0; l < width - lsize - rsize; l++)
|
||||||
buf[pos++] = row[0].style.border.top;
|
buf[pos++] = row[0].style.border.top;
|
||||||
|
|
||||||
pos -= width - lsize - rsize;
|
pos -= width - lsize - rsize;
|
||||||
|
@ -421,7 +421,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
|
||||||
buf[pos++] = row[j].style.border.left;
|
buf[pos++] = row[j].style.border.left;
|
||||||
|
|
||||||
/* print left padding */
|
/* print left padding */
|
||||||
for (int i = 0; i < row[j].style.lpad; i++)
|
for (int k = 0; k < row[j].style.lpad; k++)
|
||||||
buf[pos++] = ' ';
|
buf[pos++] = ' ';
|
||||||
|
|
||||||
/* calculate padding for sprintf */
|
/* calculate padding for sprintf */
|
||||||
|
@ -443,7 +443,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
|
||||||
pos += sprintf(&buf[pos], fmt, abspad, row[j].text);
|
pos += sprintf(&buf[pos], fmt, abspad, row[j].text);
|
||||||
|
|
||||||
/* print right padding */
|
/* print right padding */
|
||||||
for (int i = 0; i < row[j].style.rpad; i++)
|
for (int k = 0; k < row[j].style.rpad; k++)
|
||||||
buf[pos++] = ' ';
|
buf[pos++] = ' ';
|
||||||
|
|
||||||
/* if right border && not last col print right border */
|
/* if right border && not last col print right border */
|
||||||
|
@ -483,7 +483,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
|
||||||
memcpy(&buf[pos], left, lsize);
|
memcpy(&buf[pos], left, lsize);
|
||||||
pos += lsize;
|
pos += lsize;
|
||||||
|
|
||||||
for (size_t i = 0; i < width - lsize - rsize; i++)
|
for (size_t l = 0; l < width - lsize - rsize; l++)
|
||||||
buf[pos++] = tt->style.border.bottom;
|
buf[pos++] = tt->style.border.bottom;
|
||||||
|
|
||||||
memcpy(&buf[pos], right, rsize);
|
memcpy(&buf[pos], right, rsize);
|
||||||
|
|
|
@ -596,7 +596,6 @@ int main(int argc, char **argv, char **env)
|
||||||
vtysh_execute("enable");
|
vtysh_execute("enable");
|
||||||
|
|
||||||
while (cmd != NULL) {
|
while (cmd != NULL) {
|
||||||
int ret;
|
|
||||||
char *eol;
|
char *eol;
|
||||||
|
|
||||||
while ((eol = strchr(cmd->line, '\n')) != NULL) {
|
while ((eol = strchr(cmd->line, '\n')) != NULL) {
|
||||||
|
@ -662,7 +661,7 @@ int main(int argc, char **argv, char **env)
|
||||||
/* Boot startup configuration file. */
|
/* Boot startup configuration file. */
|
||||||
if (boot_flag) {
|
if (boot_flag) {
|
||||||
vtysh_flock_config(frr_config);
|
vtysh_flock_config(frr_config);
|
||||||
int ret = vtysh_read_config(frr_config);
|
ret = vtysh_read_config(frr_config);
|
||||||
vtysh_unflock_config();
|
vtysh_unflock_config();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|
|
@ -581,7 +581,7 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
struct nexthop *nh = NULL;
|
struct nexthop *nh = NULL;
|
||||||
vrf_id_t nh_vrf_id;
|
|
||||||
if (len < (int)sizeof(*rtnh)
|
if (len < (int)sizeof(*rtnh)
|
||||||
|| rtnh->rtnh_len > len)
|
|| rtnh->rtnh_len > len)
|
||||||
break;
|
break;
|
||||||
|
@ -2271,7 +2271,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
||||||
|
|
||||||
/* Drop some "permanent" entries. */
|
/* Drop some "permanent" entries. */
|
||||||
if (ndm->ndm_state & NUD_PERMANENT) {
|
if (ndm->ndm_state & NUD_PERMANENT) {
|
||||||
char buf[16] = "169.254.0.1";
|
char b[16] = "169.254.0.1";
|
||||||
struct in_addr ipv4_ll;
|
struct in_addr ipv4_ll;
|
||||||
|
|
||||||
if (ndm->ndm_family != AF_INET)
|
if (ndm->ndm_family != AF_INET)
|
||||||
|
@ -2283,7 +2283,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
||||||
if (h->nlmsg_type != RTM_DELNEIGH)
|
if (h->nlmsg_type != RTM_DELNEIGH)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
inet_pton(AF_INET, buf, &ipv4_ll);
|
inet_pton(AF_INET, b, &ipv4_ll);
|
||||||
if (ipv4_ll.s_addr != ip.ip._v4_addr.s_addr)
|
if (ipv4_ll.s_addr != ip.ip._v4_addr.s_addr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue