]> git.sur5r.net Git - openldap/commitdiff
Add strdup.c from -llutil, renamed to ldap_strdup() and always used.
authorKurt Zeilenga <kurt@openldap.org>
Fri, 20 Nov 1998 07:02:39 +0000 (07:02 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 20 Nov 1998 07:02:39 +0000 (07:02 +0000)
This will allow us to substitute malloc() at a later date.

libraries/libldap/ldap-int.h
libraries/libldap/strdup.c [new file with mode: 0644]

index 09628931fc7cbc8a1f1b265c122208888313c896..4b95a75f4f6b3f49e4152c97a1dfe109a633109d 100644 (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
diff --git a/libraries/libldap/strdup.c b/libraries/libldap/strdup.c
new file mode 100644 (file)
index 0000000..b054171
--- /dev/null
@@ -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 );
+}