From: Hallvard Furuseth Date: Wed, 29 Jul 2009 17:21:54 +0000 (+0000) Subject: For ITS#6215: No need to maintain ber->ber_usertag except at ber_printf "!" X-Git-Tag: ACLCHECK_0~385 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=29aa1d07c70f57af397cfa20392c3d669fbb73bc;p=openldap For ITS#6215: No need to maintain ber->ber_usertag except at ber_printf "!" --- diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c index f787e77683..0514f2f618 100644 --- a/libraries/liblber/encode.c +++ b/libraries/liblber/encode.c @@ -519,10 +519,16 @@ ber_printf( BerElement *ber, LDAP_CONST char *fmt, ... ) BEREncodeCallback *f; void *p; + ber->ber_usertag = 0; + f = va_arg( ap, BEREncodeCallback * ); p = va_arg( ap, void * ); - rc = (*f)( ber, p ); + + if ( ber->ber_usertag ) { + ber->ber_usertag = 0; + goto next; + } } break; case 'b': /* boolean */ @@ -579,7 +585,7 @@ ber_printf( BerElement *ber, LDAP_CONST char *fmt, ... ) case 't': /* tag for the next element */ ber->ber_tag = va_arg( ap, ber_tag_t ); ber->ber_usertag = 1; - break; + goto next; case 'v': /* vector of strings */ if ( (ss = va_arg( ap, char ** )) == NULL ) @@ -636,11 +642,8 @@ ber_printf( BerElement *ber, LDAP_CONST char *fmt, ... ) break; } - if ( ber->ber_usertag == 0 ) { - ber->ber_tag = LBER_DEFAULT; - } else { - ber->ber_usertag = 0; - } + ber->ber_tag = LBER_DEFAULT; + next:; } va_end( ap );