On Mon, Aug 16, 2010 at 9:10 AM, Robert Story <[email protected]> wrote:
> When outputting MIB values for hex digit, the code will output a leading 0 > for > values less than 16 if NETSNMP_DS_LIB_2DIGIT_HEX_OUTPUT is set. The > attached > patch makes the following changes: > > - only call netsnmp_ds_get_boolean once per string, not once per character. > This is really a performance tweak, so I'm ok with leaving it out if > people > have objections. In that case, though, at the very least the (value < 16) > check should be the first condition, so at least the functions is only > called for values where we need the configuration check. > - only do leading 0 checks for a width of 1 (one byte). A single leading 0 > doesn't make sense (IMHO) for multibyte hex values > - default to a leading 0, regardless of NETSNMP_DS_LIB_2DIGIT_HEX_OUTPUT, > for > single byte hex output when there is no separator character and no hint > from > the MIB (or there is no more hint data and we are simply repeating the > last > known hint). > > Some examples (assuming NETSNMP_DS_LIB_2DIGIT_HEX_OUTPUT is not set): > > Value Hint Current output Patched output > AA01BB "1x" AA1BB AA01BB > AA01BB "1x:" AA:1:BB AA:1:BB (no change) > > 01AA02 "1x" 1AA2 01AA02 > 01AA02 "1x:" 1:AA:2 1:AA:2 (no change) > > 01AA02 "1x:1x" 1:AA2 1:AA02 > Seems like a good idea to me. The only comment I have about the patch is that 'char' is a strange datatype choice for the boolean variable hex2digit. Why not to declare it as an integer ? Bart.
------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
