From 120b7fedaedab6f9bf8035b7e81edcb7fae6f1df Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 20 Nov 1998 07:02:39 +0000 Subject: [PATCH] Add strdup.c from -llutil, renamed to ldap_strdup() and always used. This will allow us to substitute malloc() at a later date. --- libraries/libldap/ldap-int.h | 7 +------ libraries/libldap/strdup.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 libraries/libldap/strdup.c diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index 09628931fc..4b95a75f4f 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -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 diff --git a/libraries/libldap/strdup.c b/libraries/libldap/strdup.c new file mode 100644 index 0000000000..b0541715ff --- /dev/null +++ b/libraries/libldap/strdup.c @@ -0,0 +1,19 @@ +#include "portable.h" + +#include +#include +#include + +#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 ); +} -- 2.39.5