]> git.sur5r.net Git - openldap/commitdiff
Misc allocator cleanup
authorKurt Zeilenga <kurt@openldap.org>
Sat, 5 Jan 2002 19:38:54 +0000 (19:38 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 5 Jan 2002 19:38:54 +0000 (19:38 +0000)
libraries/liblber/lber-int.h
libraries/liblber/memory.c
libraries/libldap/ldap-int.h

index 7933042bef8b9e6e2be98d5710247e76e8bcc6ca..800f7444f54c5399278fb4e4bddf82affdf25032 100644 (file)
@@ -163,29 +163,15 @@ LBER_F (char *)   ber_strndup( LDAP_CONST char *, ber_len_t );
 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))
index cbf3f730414274a165bbeb0158a11d7c81bc11df..de372348e01ac28ee3ff14a463632341614930c8 100644 (file)
@@ -112,19 +112,6 @@ static unsigned char endpattern[4] = { 0xd1, 0xed, 0xde, 0xca };
 
 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 )
 {
@@ -294,12 +281,12 @@ ber_memrealloc( void* p, ber_len_t s )
 
        /* 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;
        }
 
@@ -407,7 +394,7 @@ ber_bvecadd( struct berval ***bvec, struct berval *bv )
                        return 0;
                }
 
-               *bvec = ber_memalloc( 2 * sizeof(struct berval *) );
+               *bvec = LBER_MALLOC( 2 * sizeof(struct berval *) );
 
                if( *bvec == NULL ) {
                        return -1;
@@ -430,7 +417,7 @@ ber_bvecadd( struct berval ***bvec, struct berval *bv )
                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;
index c9e98b3e0bf6e005250ef12f22c69815d902c198..591c3e4e74cebf992273719649df51dd4b69dea1 100644 (file)
@@ -331,13 +331,6 @@ LDAP_F ( void ) ldap_int_initialize_global_options LDAP_P((
 
 /* 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)))