Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jan 2018 20:33:47 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328171 - head/contrib/bsnmp/snmpd
Message-ID:  <201801192033.w0JKXlFO096643@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Fri Jan 19 20:33:47 2018
New Revision: 328171
URL: https://svnweb.freebsd.org/changeset/base/328171

Log:
  Rename "index" variable to "idx" since gcc complains that it shadows
  index(3) function declaration.
  
  Reported by:	lwhsu
  MFC after:	2 weeks

Modified:
  head/contrib/bsnmp/snmpd/action.c
  head/contrib/bsnmp/snmpd/main.c

Modified: head/contrib/bsnmp/snmpd/action.c
==============================================================================
--- head/contrib/bsnmp/snmpd/action.c	Fri Jan 19 19:18:14 2018	(r328170)
+++ head/contrib/bsnmp/snmpd/action.c	Fri Jan 19 20:33:47 2018	(r328171)
@@ -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];
 
@@ -773,14 +773,14 @@ op_community(struct snmp_context *ctx, struct snmp_val
 	  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)
@@ -795,7 +795,7 @@ op_community(struct snmp_context *ctx, struct snmp_val
 		    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);
 		}

Modified: head/contrib/bsnmp/snmpd/main.c
==============================================================================
--- head/contrib/bsnmp/snmpd/main.c	Fri Jan 19 19:18:14 2018	(r328170)
+++ head/contrib/bsnmp/snmpd/main.c	Fri Jan 19 20:33:47 2018	(r328171)
@@ -2028,13 +2028,13 @@ asn_error_func(const struct asn_buf *b, const char *er
  * 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)
@@ -2061,7 +2061,7 @@ comm_define_ordered(u_int priv, const char *descr, str
 	/*
 	 * 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);
@@ -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;
 
@@ -2094,7 +2094,7 @@ comm_define(u_int priv, const char *descr, struct lmod
 	if (owner != NULL)
 		p = &owner->index;
 	else {
-		p = &index;
+		p = &idx;
 		p->len = 1;
 		p->subs[0] = 0;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801192033.w0JKXlFO096643>