3 http://net-snmp.svn.sourceforge.net/viewvc/net-snmp?view=rev&revision=16804
5 --- branches/V5-4-patches/net-snmp/snmplib/container.c 2008/02/13 23:11:48 16803
6 +++ branches/V5-4-patches/net-snmp/snmplib/container.c 2008/02/13 23:37:48 16804
8 * These functions should EXACTLY match the inline version in
9 * container.h. If you change one, change them both.
11 -int CONTAINER_INSERT(netsnmp_container *x, const void *k)
15 - /** start at first container */
18 - for(; x; x = x->next) {
19 - if ((NULL != x->insert_filter) &&
20 - (x->insert_filter(x,k) == 1))
22 - rc2 = x->insert(x,k);
24 +int CONTAINER_INSERT_HELPER(netsnmp_container* x, const void* k)
26 + while(x && x->insert_filter && x->insert_filter(x,k) == 1)
29 + int rc = x->insert(x,k);
31 snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n",
32 - x->container_name ? x->container_name : "", rc2);
34 + x->container_name ? x->container_name : "", rc);
36 + rc = CONTAINER_INSERT_HELPER(x->next, k);
46 +/*------------------------------------------------------------------
47 + * These functions should EXACTLY match the inline version in
48 + * container.h. If you change one, change them both.
50 +int CONTAINER_INSERT(netsnmp_container* x, const void* k)
52 + /** start at first container */
55 + return CONTAINER_INSERT_HELPER(x, k);
58 /*------------------------------------------------------------------
59 --- branches/V5-4-patches/net-snmp/include/net-snmp/library/container.h 2008/02/13 23:11:48 16803
60 +++ branches/V5-4-patches/net-snmp/include/net-snmp/library/container.h 2008/02/13 23:37:48 16804
62 * container.c. If you change one, change them both.
64 NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
65 - int CONTAINER_INSERT(netsnmp_container *x, const void *k)
66 + int CONTAINER_INSERT_HELPER(netsnmp_container* x, const void* k)
70 - /** start at first container */
73 - for(; x; x = x->next) {
74 - if ((NULL != x->insert_filter) &&
75 - (x->insert_filter(x,k) == 1))
77 - rc2 = x->insert(x,k);
79 + while(x && x->insert_filter && x->insert_filter(x,k) == 1)
82 + int rc = x->insert(x,k);
84 snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n",
85 - x->container_name ? x->container_name : "", rc2);
87 + x->container_name ? x->container_name : "", rc);
89 + rc = CONTAINER_INSERT_HELPER(x->next, k);
100 + /*------------------------------------------------------------------
101 + * These functions should EXACTLY match the function version in
102 + * container.c. If you change one, change them both.
104 + NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
105 + int CONTAINER_INSERT(netsnmp_container* x, const void* k)
107 + /** start at first container */
110 + return CONTAINER_INSERT_HELPER(x, k);
113 /*------------------------------------------------------------------
114 * These functions should EXACTLY match the function version in
115 * container.c. If you change one, change them both.