[Date Prev][Date Next] [Chronological] [Thread] [Top]

memory allocation changes



I've committed a number of API enhancements to provide
additional flexibility to application developers.  These
include the following API calls:

LDAP_F( void * )
ber_memalloc LDAP_P((
    size_t s ));
 
LDAP_F( void * )
ber_memrealloc LDAP_P((
    void* p,
    size_t s ));
 
LDAP_F( void * )
ber_memcalloc LDAP_P((
    size_t n,
    size_t s )); 
 
LDAP_F( void )
ber_memfree LDAP_P((
    void* p ));

The routines are compatible with ber_*free and ldap_*free()
routines.

I've also added similiar -lldap routines (s/ber_mem/ldap_mem/)
which are wrappers for the above.

In addition, I've added a mechanism for applications to
provide replace memory routines.  At present, four hooks
(malloc, calloc, realloc, free) are available settable
using:
	BerMemoryFunctions fns = { malloc, calloc, realloc, free };
	ber_set_option(NULL, LBER_OPT_MEMORY_FNS, &fns);

(the ber_set_option MUST be very first -llber (or -lldap) call).

I've also toyed around with the idea of using a single
hook based upon realloc...

This is a work in progress.  Your comments are appreciated.

Kurt