X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Fliblber%2Foptions.c;h=d2371567e706a781d6b6ecc4c063bb26967e2c18;hb=afa2cd1893875266c58677cc640514c1d9eef41f;hp=64e7fcc4662ceae3ae4589f737a5fcbbca7d7fbf;hpb=978e417699699579fb0b858ad485f36399220c4d;p=openldap diff --git a/libraries/liblber/options.c b/libraries/liblber/options.c index 64e7fcc466..d2371567e7 100644 --- a/libraries/liblber/options.c +++ b/libraries/liblber/options.c @@ -1,6 +1,6 @@ /* $OpenLDAP$ */ /* - * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ #include "portable.h" @@ -10,13 +10,10 @@ #include #include "lber-int.h" -/* bprint.c */ -typedef void (*BER_LOG_FN) LDAP_P((FILE *file, char *subsys, int level, const char *fmt, va_list vl)); -extern void * ber_pvt_err_file; -extern BER_LOG_FN ber_int_log_proc; +char ber_pvt_opt_on; /* used to get a non-NULL address for *_OPT_ON */ struct lber_options ber_int_options = { - LBER_UNINITIALIZED, 0, 0 }; + LBER_UNINITIALIZED, 0, 0, 0 }; int ber_get_option( @@ -91,6 +88,11 @@ ber_get_option( *((ber_len_t *) outvalue) = ber_pvt_ber_write(ber); return LBER_OPT_SUCCESS; + case LBER_OPT_BER_MEMCTX: + assert( LBER_VALID( ber ) ); + *((void **) outvalue) = ber->ber_memctx; + return LBER_OPT_SUCCESS; + default: /* bad param */ ber_errno = LBER_ERROR_PARAM; @@ -126,7 +128,7 @@ ber_set_option( } ber_int_memory_fns = (BerMemoryFunctions *) - (*(f->bmf_malloc))(sizeof(BerMemoryFunctions)); + (*(f->bmf_malloc))(sizeof(BerMemoryFunctions), NULL); if ( ber_int_memory_fns == NULL ) { ber_errno = LBER_ERROR_MEMORY; @@ -209,6 +211,11 @@ ber_set_option( ber->ber_ptr = &ber->ber_buf[* (const ber_len_t *) invalue]; return LBER_OPT_SUCCESS; + case LBER_OPT_BER_MEMCTX: + assert( LBER_VALID( ber ) ); + ber->ber_memctx = *(void **)invalue; + return LBER_OPT_SUCCESS; + default: /* bad param */ ber_errno = LBER_ERROR_PARAM;