From: Kurt Zeilenga Date: Fri, 20 Nov 1998 07:02:39 +0000 (+0000) Subject: Add strdup.c from -llutil, renamed to ldap_strdup() and always used. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~1077 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=120b7fedaedab6f9bf8035b7e81edcb7fae6f1df;p=openldap Add strdup.c from -llutil, renamed to ldap_strdup() and always used. This will allow us to substitute malloc() at a later date. --- 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 ); +}