On tis, 2007-10-23 at 10:10 +0100, Dave Shield wrote:
> On 22/10/2007, Magnus Fromreide <[EMAIL PROTECTED]> wrote:
> > I would like to remove the following functions as they are redundant,
> > all that they do can be done by other, more general functions.
> 
> Do you propose to remove them completely, or replace them by wrappers
> round the more general function?

I intended to remove them completley.

I change the code (netsnmp_register_read_only_long_instance) from:

    netsnmp_handler_registration *myreg;

    myreg = get_reg(name, "long_handler", reg_oid, reg_oid_len, it,
                    HANDLER_CAN_RONLY, netsnmp_instance_long_handler,
                    subhandler, NULL);
    return netsnmp_register_read_only_instance(myreg);

to:

    return netsnmp_register_watched_instance(
               netsnmp_create_handler_registration(
                   name, subhandler, reg_oid, reg_oid_len, HANDLER_CAN_RONLY),
               netsnmp_create_watcher_info(
                   (void *)it, sizeof(long), ASN_INTEGER, WATCHER_FIXED_SIZE));

and then netsnmp_instance_long_handler becomes unused.

> I don't think there would be any objections to consolidating the code
> by means of simple wrappers. 

Yes, but here there is no reasonable wrapper as I use different code to
achieve the same result. It feels silly that we have two ways to return
values since the watcher helper can do all kinds of objects.

The pros and cons of them are as I see it:

watcher:
+ Only one function to handle any data type so the code gets smaller
- mallocs a data chunk (5 words at the moment, I intend to grow it to 6
  words soon) to store information of the variable

instance:
+ no additional memory needed beyond the registration.

/MF


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to