On 2007-07-04 17:42:57 +0200, Marcus Rueckert wrote:
> all the asserts removed in this patch use != or == for string
> comparison, which is undefined in C. after a discussion on irc with Wes
> and Robert, i followed Wes' suggestion and removed the offending
> asserts.
> 
> Can we still apply it for 5.4.1?:)

ok after another discussion on irc with robert and thomas, we got v2 of
the patch. instead of removing the asserts we make the conditions static
strings. the compiler shuts up and robert still gets his debug message.

the patch passed the testsuite

please vote!:)

    darix

-- 
          openSUSE - SUSE Linux is my linux
              openSUSE is good for you
                  www.opensuse.org
Index: agent/agent_registry.c
===================================================================
--- agent/agent_registry.c.orig	2006-10-18 05:19:26.000000000 +0200
+++ agent/agent_registry.c	2007-07-02 20:35:34.788957893 +0200
@@ -532,7 +532,7 @@ netsnmp_subtree_load(netsnmp_subtree *ne
 	
 	    if (next && (next->namelen  == new_sub->namelen) &&
 		(next->priority == new_sub->priority)) {
-                netsnmp_assert("registration" != "duplicate");
+                netsnmp_assert("registration != duplicate");
 		return MIB_DUPLICATE_REGISTRATION;
 	    }
 
@@ -626,7 +625,7 @@ netsnmp_register_mib(const char *moduleN
         snmp_log(LOG_WARNING,"context passed during registration does not "
                  "equal the reginfo contextName! ('%s' != '%s')\n",
                  context, reginfo->contextName);
-        netsnmp_assert("register context" == "reginfo->contextName");
+        netsnmp_assert(!"register context == reginfo->contextName");
     }
 
     /*  Create the new subtree node being registered.  */
Index: agent/mibgroup/ip-forward-mib/data_access/route_common.c
===================================================================
--- agent/mibgroup/ip-forward-mib/data_access/route_common.c.orig	2005-12-10 17:35:37.000000000 +0100
+++ agent/mibgroup/ip-forward-mib/data_access/route_common.c	2007-07-02 20:23:46.190220170 +0200
@@ -173,7 +173,7 @@ netsnmp_access_route_entry_set(netsnmp_r
     }
     else {
         snmp_log(LOG_ERR,"netsnmp_access_route_entry_set with no mode\n");
-        netsnmp_assert("route_entry_set" == "unknown mode"); 
+        netsnmp_assert(!"route_entry_set == unknown mode"); 
         rc = -1;
     }
     
Index: agent/mibgroup/ip-mib/data_access/ipaddress_common.c
===================================================================
--- agent/mibgroup/ip-mib/data_access/ipaddress_common.c.orig	2007-04-30 13:04:54.000000000 +0200
+++ agent/mibgroup/ip-mib/data_access/ipaddress_common.c	2007-07-02 20:23:46.214221617 +0200
@@ -239,7 +239,7 @@ netsnmp_access_ipaddress_entry_set(netsn
     }
     else {
         snmp_log(LOG_ERR,"netsnmp_access_ipaddress_entry_set with no mode\n");
-        netsnmp_assert("ipaddress_entry_set" == "unknown mode"); 
+        netsnmp_assert(!"ipaddress_entry_set == unknown mode"); 
         rc = -1;
     }
     
Index: agent/mibgroup/mibII/icmp.c
===================================================================
--- agent/mibgroup/mibII/icmp.c.orig	2006-09-15 02:48:50.000000000 +0200
+++ agent/mibgroup/mibII/icmp.c	2007-07-02 20:23:46.230222582 +0200
@@ -178,7 +178,7 @@ icmp_handler(netsnmp_mib_handler        
     icmp_load(NULL, NULL);
 #elif !defined(hpux11)
     if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
-        netsnmp_assert("cache" == "valid"); /* always false */
+        netsnmp_assert(!"cache == valid"); /* always false */
         icmp_load( NULL, NULL );	/* XXX - check for failure */
     }
 #endif
Index: agent/mibgroup/mibII/ip.c
===================================================================
--- agent/mibgroup/mibII/ip.c.orig	2006-09-15 02:48:50.000000000 +0200
+++ agent/mibgroup/mibII/ip.c	2007-07-02 20:23:46.246223547 +0200
@@ -250,7 +250,7 @@ ip_handler(netsnmp_mib_handler          
     ip_load(NULL, NULL);
 #elif !defined(hpux11)
     if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
-        netsnmp_assert("cache" == "valid"); /* always false */
+        netsnmp_assert(!"cache == valid"); /* always false */
         ip_load( NULL, NULL );	/* XXX - check for failure */
     }
 #endif
Index: agent/mibgroup/mibII/tcp.c
===================================================================
--- agent/mibgroup/mibII/tcp.c.orig	2006-09-15 02:48:50.000000000 +0200
+++ agent/mibgroup/mibII/tcp.c	2007-07-02 20:23:46.290226201 +0200
@@ -215,7 +215,7 @@ tcp_handler(netsnmp_mib_handler         
     tcp_load(NULL, NULL);
 #elif !defined(hpux11)
     if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
-        netsnmp_assert("cache" == "valid"); /* always false */
+        netsnmp_assert(!"cache == valid"); /* always false */
         tcp_load( NULL, NULL );	/* XXX - check for failure */
     }
 #endif
Index: agent/mibgroup/mibII/udp.c
===================================================================
--- agent/mibgroup/mibII/udp.c.orig	2006-09-15 02:48:50.000000000 +0200
+++ agent/mibgroup/mibII/udp.c	2007-07-02 20:23:46.306227166 +0200
@@ -197,7 +197,7 @@ udp_handler(netsnmp_mib_handler         
     udp_load(NULL, NULL);
 #elif !defined(hpux11)
     if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
-        netsnmp_assert("cache" == "valid"); /* always false */
+        netsnmp_assert(!"cache == valid"); /* always false */
         udp_load( NULL, NULL );	/* XXX - check for failure */
     }
 #endif
Index: snmplib/data_list.c
===================================================================
--- snmplib/data_list.c.orig	2006-08-23 17:53:22.000000000 +0200
+++ snmplib/data_list.c	2007-07-02 20:23:46.322228131 +0200
@@ -105,7 +105,7 @@ netsnmp_data_list_add_node(netsnmp_data_
 
     DEBUGMSGTL(("data_list","adding key '%s'\n", node->name));
     if (0 == strcmp(node->name, (*head)->name)) {
-        netsnmp_assert("list key" == "is unique"); /* always fail */
+        netsnmp_assert(!"list key == is unique"); /* always fail */
         snmp_log(LOG_WARNING,
                  "WARNING: adding duplicate key '%s' to data list\n",
                  node->name);
@@ -114,7 +113,7 @@ netsnmp_data_list_add_node(netsnmp_data_
     for (ptr = *head; ptr->next != NULL; ptr = ptr->next) {
         netsnmp_assert(NULL != ptr->name);
         if (0 == strcmp(node->name, ptr->name)) {
-            netsnmp_assert("list key" == "is unique"); /* always fail */
+            netsnmp_assert(!"list key == is unique"); /* always fail */
             snmp_log(LOG_WARNING,
                      "WARNING: adding duplicate key '%s' to data list\n",
                      node->name);
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to