mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 23:59:34 -05:00
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:
parent
05059be190
commit
120b7fedae
2 changed files with 20 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
19
libraries/libldap/strdup.c
Normal file
19
libraries/libldap/strdup.c
Normal 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 );
|
||||
}
|
||||
Loading…
Reference in a new issue