mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
2f969f8552
myrealloc is pointer to a realloc() wrapper. Must be first library call or else.
53 lines
915 B
C
53 lines
915 B
C
/*
|
|
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
*/
|
|
#include "portable.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "lber-int.h"
|
|
|
|
void
|
|
ber_memfree( void *p )
|
|
{
|
|
ber_int_options.lbo_valid = LBER_INITIALIZED;
|
|
LBER_FREE( p );
|
|
}
|
|
|
|
void *
|
|
ber_memalloc( size_t s )
|
|
{
|
|
ber_int_options.lbo_valid = LBER_INITIALIZED;
|
|
return LBER_MALLOC( s );
|
|
}
|
|
|
|
void *
|
|
ber_memcalloc( size_t n, size_t s )
|
|
{
|
|
ber_int_options.lbo_valid = LBER_INITIALIZED;
|
|
return LBER_CALLOC( n, s );
|
|
}
|
|
|
|
void *
|
|
ber_memrealloc( void* p, size_t s )
|
|
{
|
|
ber_int_options.lbo_valid = LBER_INITIALIZED;
|
|
return LBER_REALLOC( p, s );
|
|
}
|
|
|
|
BER_MEMORY_FN ber_int_realloc = NULL;
|
|
|
|
void *
|
|
ber_int_calloc( size_t n, size_t s )
|
|
{
|
|
ber_int_options.lbo_valid = LBER_INITIALIZED;
|
|
|
|
{
|
|
size_t size = n * s;
|
|
void *p = (*ber_int_realloc)( NULL, size );
|
|
return p ? memset( p, 0, size ) : p;
|
|
}
|
|
}
|
|
|