LBER_F (char *) ber_strndup__( LDAP_CONST char *, size_t );
#ifdef CSRIMALLOC
-#define LBER_INT_MALLOC malloc
-#define LBER_INT_CALLOC calloc
-#define LBER_INT_REALLOC realloc
-#define LBER_INT_FREE free
-#define LBER_INT_VFREE ber_memvfree
-#define LBER_INT_STRDUP strdup
-
#define LBER_MALLOC malloc
#define LBER_CALLOC calloc
#define LBER_REALLOC realloc
#define LBER_FREE free
#define LBER_VFREE ber_memvfree
#define LBER_STRDUP strdup
-#define LBER_STRNDUP ber_strndup__
+#define LBER_STRNDUP ber_strndup__
#else
-#define LBER_INT_MALLOC(s) ber_memalloc((s))
-#define LBER_INT_CALLOC(n,s) ber_memcalloc((n),(s))
-#define LBER_INT_REALLOC(p,s) ber_memrealloc((p),(s))
-#define LBER_INT_FREE(p) ber_memfree((p))
-#define LBER_INT_VFREE(v) ber_memvfree((void**)(v))
-#define LBER_INT_STRDUP(s) ber_strdup((s))
-
#define LBER_MALLOC(s) ber_memalloc((s))
#define LBER_CALLOC(n,s) ber_memcalloc((n),(s))
#define LBER_REALLOC(p,s) ber_memrealloc((p),(s))
BerMemoryFunctions *ber_int_memory_fns = NULL;
-#if 0 && defined( LDAP_MEMORY_DEBUG )
-void
-ber_int_memfree( void **p )
-{
- assert( p != NULL );
- BER_MEM_VALID( *p );
-
- ber_memfree( p );
-
- *p = BER_MEM_BADADDR;
-}
-#endif
-
void
ber_memfree( void *p )
{
/* realloc(NULL,s) -> malloc(s) */
if( p == NULL ) {
- return ber_memalloc( s );
+ return LBER_MALLOC( s );
}
/* realloc(p,0) -> free(p) */
if( s == 0 ) {
- ber_memfree( p );
+ LBER_FREE( p );
return NULL;
}
return 0;
}
- *bvec = ber_memalloc( 2 * sizeof(struct berval *) );
+ *bvec = LBER_MALLOC( 2 * sizeof(struct berval *) );
if( *bvec == NULL ) {
return -1;
return i;
}
- new = ber_memrealloc( *bvec, (i+2) * sizeof(struct berval *));
+ new = LBER_REALLOC( *bvec, (i+2) * sizeof(struct berval *));
if( new == NULL ) {
return -1;
/* memory.c */
/* simple macros to realloc for now */
-#define LDAP_INT_MALLOC(s) (LBER_MALLOC((s)))
-#define LDAP_INT_CALLOC(n,s) (LBER_CALLOC((n),(s)))
-#define LDAP_INT_REALLOC(p,s) (LBER_REALLOC((p),(s)))
-#define LDAP_INT_FREE(p) (LBER_FREE((p)))
-#define LDAP_INT_VFREE(v) (LBER_VFREE((void **)(v)))
-#define LDAP_INT_STRDUP(s) (LBER_STRDUP((s)))
-
#define LDAP_MALLOC(s) (LBER_MALLOC((s)))
#define LDAP_CALLOC(n,s) (LBER_CALLOC((n),(s)))
#define LDAP_REALLOC(p,s) (LBER_REALLOC((p),(s)))