]> git.sur5r.net Git - openldap/commitdiff
Revert ber_peek_tag to older, more efficient implementation.
authorKurt Zeilenga <kurt@openldap.org>
Wed, 26 Jul 2000 23:32:39 +0000 (23:32 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 26 Jul 2000 23:32:39 +0000 (23:32 +0000)
libraries/liblber/decode.c

index 99ff60b90883ae10763d4d3fd6904e36b1a49228..ef12bf46d61b64dc42dc2cee01d3b84c36121dc0 100644 (file)
@@ -136,29 +136,22 @@ ber_skip_tag( BerElement *ber, ber_len_t *len )
 
 ber_tag_t
 ber_peek_tag(
-       BerElement *ber_in,
+       BerElement *ber,
        ber_len_t *len )
 {
-       ber_tag_t       tag;
-       BerElement *ber;
-
-       assert( ber_in != NULL );
-       assert( BER_VALID( ber_in ) );
-
-       *len = 0;
-
-       ber = ber_dup( ber_in );
-
-       if( ber == NULL ) {
-               return LBER_ERROR;
-       }
+       /*
+        * This implementation assumes ber_skip_tag() only
+        * modifies ber_ptr field of the BerElement.
+        */
 
-       assert( BER_VALID( ber ) );
+       char *save;
+       ber_tag_t       tag;
 
+       save = ber->ber_ptr;
        tag = ber_skip_tag( ber, len );
+       ber->ber_ptr = save;
 
-       ber_free( ber, 0 );
-       return( tag );
+       return tag;
 }
 
 static ber_len_t