Add strdup.c from -llutil, renamed to ldap_strdup() and always used.

This will allow us to substitute malloc() at a later date.
This commit is contained in:
Kurt Zeilenga 1998-11-20 07:02:39 +00:00
parent 05059be190
commit 120b7fedae
2 changed files with 20 additions and 6 deletions

View file

@ -242,12 +242,7 @@ BerElement *ldap_build_search_req( LDAP *ld, char *base, int scope,
/*
* in strdup.c
*/
#ifdef HAVE_STRDUP
#define ldap_strdup(s) strdup(s)
extern char *strdup();
#else
extern char *ldap_strdup LDAP_P(( const char * ));
#endif
char *ldap_strdup LDAP_P(( const char * ));
/*
* in unbind.c

View file

@ -0,0 +1,19 @@
#include "portable.h"
#include <stdlib.h>
#include <ac/string.h>
#include <ac/time.h>
#include "ldap-int.h"
char *(ldap_strdup)( const char *s )
{
char *p;
if ( (p = (char *) malloc( strlen( s ) + 1 )) == NULL )
return( (char *)0 );
strcpy( p, s );
return( p );
}