--=-+ae6/Y6NeDcYFBdMaAZ2
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Are patches like the attached ones of interest for the project or should
I just ignore such things when I see them?

The advantage of the patches is that they make the code more local so
you do not have to keep track of lots of function scope variables, see
for instance make-zone-local where there are two uses of the variable,
25 and 50 lines from the declaration or make-len-local where the use is
90 lines from the declaration.

make-len-local
Move the len variable from function scope to the scope of the if
clause where it i used.

make-zone-local
Move the zone variable from function scopes of the two if
clauses where it is used.

remove-unused-variable
Removes the unused variable sinkport
Makes the indentation of the *st variable consistent with the
*sp variable above it. (Possibly the declarations of those two
should be folded together, if so then that is for a later
patch)

/MF

--=-+ae6/Y6NeDcYFBdMaAZ2
Content-Disposition: attachment; filename=make-len-local
Content-Type: text/x-patch; name=make-len-local; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Index: clean/agent/agent_trap.c
================================================== =================
--- clean.orig/agent/agent_trap.c 2007-02-15 21:01:13.000000000 +0100
+++ clean/agent/agent_trap.c 2007-02-15 21:41:08.000000000 +0100
@@ -342,7 +342,6 @@
netsnmp_pdu *template_v1pdu;
netsnmp_variable_list *first_vb, *vblist;
netsnmp_variable_list *var;
- size_t len;

/*
* Make a copy of the v2 Trap PDU
@@ -434,7 +433,7 @@
* For enterprise-specific traps, split the snmpTrapOID value
* into enterprise and specific trap
*/
- len = vblist->val_len / sizeof(oid);
+ size_t len = vblist->val_len / sizeof(oid);
if ( len <= 2 ) {
snmp_log(LOG_WARNING,
"send_trap: v2 trapOID too short (%d)\n", len);

--=-+ae6/Y6NeDcYFBdMaAZ2
Content-Disposition: attachment; filename=make-zone-local
Content-Type: text/x-patch; name=make-zone-local; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Index: clean/snmplib/mib.c
================================================== =================
--- clean.orig/snmplib/mib.c 2007-01-01 20:07:43.000000000 +0100
+++ clean/snmplib/mib.c 2007-01-01 20:08:43.000000000 +0100
@@ -3958,7 +3958,6 @@
if (buf) {
int i, len;
char intbuf[64], * p;
- unsigned long zone;

memset(intbuf, 0, 64);

@@ -3975,7 +3974,7 @@
len = sprintf(p, "%lu.%lu.%lu.%lu", objid[0], objid[1], objid[2], objid[3]);
p += len;
if (addr_type == IPV4Z) {
- zone = ntohl((long)objid[4]);
+ unsigned long zone = ntohl((long)objid[4]);
len = sprintf(p, "%%%lu", zone);
p += len;
}
@@ -3996,7 +3995,7 @@
p-- ; /* do not include the last ':' */

if (addr_type == IPV6Z) {
- zone = ntohl((long)objid[16]);
+ unsigned long zone = ntohl((long)objid[16]);
len = sprintf(p, "%%%lu", zone);
p += len;
}

--=-+ae6/Y6NeDcYFBdMaAZ2
Content-Disposition: attachment; filename=remove-unused-variable
Content-Type: text/x-patch; name=remove-unused-variable; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Index: clean/agent/agent_trap.c
================================================== =================
--- clean.orig/agent/agent_trap.c 2007-02-15 21:41:08.000000000 +0100
+++ clean/agent/agent_trap.c 2007-02-15 21:41:37.000000000 +0100
@@ -1093,8 +1093,7 @@
{
char tmpbuf[1024];
char *sp, *cp, *pp = NULL;
- int sinkport;
- char *st;
+ char *st;

if (!snmp_trapcommunity)
snmp_trapcommunity = strdup("public");
@@ -1116,8 +1115,7 @@
{
char tmpbuf[1024];
char *sp, *cp, *pp = NULL;
- int sinkport;
- char *st;
+ char *st;

if (!snmp_trapcommunity)
snmp_trapcommunity = strdup("public");

--=-+ae6/Y6NeDcYFBdMaAZ2
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?p...rge&CID=DEVDEV
--=-+ae6/Y6NeDcYFBdMaAZ2
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders

--=-+ae6/Y6NeDcYFBdMaAZ2--