>>>>> On Thu, 6 Jan 2011 18:44:04 +0100, Bart Van Assche <[email protected]>
>>>>> said:
BVA> Having to set a flag before every call of netsnmp_register_table_iterator()
BVA> is tedious and error-prone.
Having to remember which function call to use with a simple 2 suffix or
not suffix seems error prone and subject to memory bloat :-P
BVA> Another alternative is to remove netsnmp_register_table_iterator() and to
BVA> rename netsnmp_register_table_iterator2() into
BVA> netsnmp_register_table_iterator(), but doing so would break backwards
BVA> compatibility.
I'd argue the requirement to own the pointer is probably sometimes good
one way and sometimes not. Hence the flag.
The third alternative is to provide a macro, which removes the code
bloat in the library and still allows you to have a separate function if
you're unwilling to add the line of code above the register call.
[and we're arguing about "coding taste" here, so it's important to
realize neither of us is "wrong". [or we both are depending on your
point of view ;-) ]]
#define netsnmp_register_table_iterator2(x,y) \
do { \
y->flags |= NETSNMP_TABLE_ITERATOR_OWNS_INFO_PTR; \
netsnmp_register_table_iterator(x,y); \
} while(0);
I really dislike having one function be a near mirror of another because
it means not only does the size of the executable increase but it leaves
two places to maintain code. We've had many cases in the past where
changes were made to one function to fix bugs that were forgotten for a
parallel function..
--
Wes Hardaker
Please mail all replies to [email protected]
------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web. Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders