Skip to content

Commit

Permalink
Rename "index" variable to "idx" since gcc complains that it shadows
Browse files Browse the repository at this point in the history
index(3) function declaration.

Reported by:	lwhsu
MFC after:	2 weeks
  • Loading branch information
bu7cher committed Jan 19, 2018
1 parent c35fca4 commit 7e03e18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions contrib/bsnmp/snmpd/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ int
op_community(struct snmp_context *ctx, struct snmp_value *value,
u_int sub, u_int iidx __unused, enum snmp_op op)
{
struct asn_oid index;
struct asn_oid idx;
struct community *c;
asn_subid_t which = value->var.subs[sub - 1];

Expand All @@ -773,14 +773,14 @@ op_community(struct snmp_context *ctx, struct snmp_value *value,
case SNMP_OP_SET:
if (community != COMM_INITIALIZE && snmpd.comm_dis)
return (SNMP_ERR_NOT_WRITEABLE);
index.len = 2;
index.subs[0] = 0;
index.subs[1] = value->var.subs[value->var.len - 1];
idx.len = 2;
idx.subs[0] = 0;
idx.subs[1] = value->var.subs[value->var.len - 1];
switch (which) {
case LEAF_begemotSnmpdCommunityString:
/* check that given string is unique */
TAILQ_FOREACH(c, &community_list, link) {
if (!asn_compare_oid(&index, &c->index))
if (!asn_compare_oid(&idx, &c->index))
continue;
if (c->string != NULL && strcmp(c->string,
value->v.octetstring.octets) == 0)
Expand All @@ -795,7 +795,7 @@ op_community(struct snmp_context *ctx, struct snmp_value *value,
sub)) == NULL) {
/* create new community and use user sepcified index */
c = comm_define_ordered(COMM_READ, "SNMP Custom Community",
&index, NULL, NULL);
&idx, NULL, NULL);
if (c == NULL)
return (SNMP_ERR_NO_CREATION);
}
Expand Down
10 changes: 5 additions & 5 deletions contrib/bsnmp/snmpd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2028,13 +2028,13 @@ asn_error_func(const struct asn_buf *b, const char *err, ...)
* Create a new community
*/
struct community*
comm_define_ordered(u_int priv, const char *descr, struct asn_oid *index,
comm_define_ordered(u_int priv, const char *descr, struct asn_oid *idx,
struct lmodule *owner, const char *str)
{
struct community *c, *p;
u_int ncomm;

ncomm = index->subs[index->len - 1];
ncomm = idx->subs[idx->len - 1];

/* check that community doesn't already exist */
TAILQ_FOREACH(c, &community_list, link)
Expand All @@ -2061,7 +2061,7 @@ comm_define_ordered(u_int priv, const char *descr, struct asn_oid *index,
/*
* Insert ordered
*/
c->index = *index;
c->index = *idx;
TAILQ_FOREACH(p, &community_list, link) {
if (asn_compare_oid(&p->index, &c->index) > 0) {
TAILQ_INSERT_BEFORE(p, c, link);
Expand All @@ -2077,7 +2077,7 @@ u_int
comm_define(u_int priv, const char *descr, struct lmodule *owner,
const char *str)
{
struct asn_oid index, *p;
struct asn_oid idx, *p;
struct community *c;
u_int ncomm;

Expand All @@ -2094,7 +2094,7 @@ comm_define(u_int priv, const char *descr, struct lmodule *owner,
if (owner != NULL)
p = &owner->index;
else {
p = &index;
p = &idx;
p->len = 1;
p->subs[0] = 0;
}
Expand Down

0 comments on commit 7e03e18

Please sign in to comment.