--- Net-SNMP-XS/XS.xs 2009/04/09 05:56:36 1.6 +++ Net-SNMP-XS/XS.xs 2009/04/09 07:10:23 1.7 @@ -4,6 +4,8 @@ // C99 required +#define BENCHMARK + #define ASN_BOOLEAN 0x01 #define ASN_INTEGER32 0x02 #define ASN_OCTET_STRING 0x04 @@ -17,8 +19,6 @@ #define ASN_OPAQUE 0x44 #define ASN_COUNTER64 0x46 -//#define BENCHMARK - #define MAX_OID_STRLEN 4096 static SV *msg; @@ -212,8 +212,8 @@ return buf; } -static char * -process_object_identifier (int *len) +static SV * +process_object_identifier_sv (void) { U32 length = process_length (); @@ -242,17 +242,7 @@ app = write_uv (app, w); } - *len = app - oid; - return oid; -} - -static SV * -process_object_identifier_sv (void) -{ - int len; - char *oid = process_object_identifier (&len); - - return newSVpvn (oid, len); + return newSVpvn (oid, app - oid); } static AV *av_type; @@ -492,12 +482,12 @@ if (get8 () != ASN_OBJECT_IDENTIFIER) error ("OBJECT IDENTIFIER expected at beginning of VarBind"); int type, oidlen; - char *oid = process_object_identifier (&oidlen); + SV *oid = process_object_identifier_sv (); SV *val = process_sv (&type); - hv_store (types, oid, oidlen, newSViv (type), 0); - hv_store (list , oid, oidlen, val, 0); - av_push (names, newSVpvn (oid, oidlen)); + hv_store_ent (types, oid, newSViv (type), 0); + hv_store_ent (list , oid, val, 0); + av_push (names, oid); } //return $this->_report_pdu_error if ($this->{_pdu_type} == REPORT);