Commit b072bb49 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

wldap32: Use the strdup function instead of reimplementing it.

parent c6cdea71
...@@ -266,7 +266,7 @@ ULONG WINAPIV WLDAP32_ber_scanf( WLDAP32_BerElement *ber, char *fmt, ... ) ...@@ -266,7 +266,7 @@ ULONG WINAPIV WLDAP32_ber_scanf( WLDAP32_BerElement *ber, char *fmt, ... )
{ {
char *str, **ptr = va_arg( list, char ** ); char *str, **ptr = va_arg( list, char ** );
if ((ret = ber_scanf( BER(ber), new_fmt, &str )) == -1) break; if ((ret = ber_scanf( BER(ber), new_fmt, &str )) == -1) break;
*ptr = strdupU( str ); *ptr = strdup( str );
ldap_memfree( str ); ldap_memfree( str );
break; break;
} }
......
...@@ -197,7 +197,7 @@ ULONG CDECL ldap_encode_sort_controlA( LDAP *ld, LDAPSortKeyA **sortkeys, LDAPCo ...@@ -197,7 +197,7 @@ ULONG CDECL ldap_encode_sort_controlA( LDAP *ld, LDAPSortKeyA **sortkeys, LDAPCo
if ((result = ldap_create_sort_controlA( ld, sortkeys, critical, &control )) == WLDAP32_LDAP_SUCCESS) if ((result = ldap_create_sort_controlA( ld, sortkeys, critical, &control )) == WLDAP32_LDAP_SUCCESS)
{ {
ret->ldctl_oid = strdupU(control->ldctl_oid); ret->ldctl_oid = strdup( control->ldctl_oid );
bv_val_dup( &control->ldctl_value, &ret->ldctl_value ); bv_val_dup( &control->ldctl_value, &ret->ldctl_value );
ret->ldctl_iscritical = control->ldctl_iscritical; ret->ldctl_iscritical = control->ldctl_iscritical;
ldap_control_freeA( control ); ldap_control_freeA( control );
......
...@@ -36,7 +36,7 @@ static char **split_hostnames( const char *hostnames ) ...@@ -36,7 +36,7 @@ static char **split_hostnames( const char *hostnames )
char **res, *str, *p, *q; char **res, *str, *p, *q;
unsigned int i = 0; unsigned int i = 0;
str = strdupU( hostnames ); str = strdup( hostnames );
if (!str) return NULL; if (!str) return NULL;
p = str; p = str;
...@@ -72,7 +72,7 @@ static char **split_hostnames( const char *hostnames ) ...@@ -72,7 +72,7 @@ static char **split_hostnames( const char *hostnames )
if (isspace( *p )) if (isspace( *p ))
{ {
*p = '\0'; p++; *p = '\0'; p++;
res[i] = strdupU( q ); res[i] = strdup( q );
if (!res[i]) goto oom; if (!res[i]) goto oom;
i++; i++;
...@@ -82,7 +82,7 @@ static char **split_hostnames( const char *hostnames ) ...@@ -82,7 +82,7 @@ static char **split_hostnames( const char *hostnames )
} }
else else
{ {
res[i] = strdupU( q ); res[i] = strdup( q );
if (!res[i]) goto oom; if (!res[i]) goto oom;
i++; i++;
} }
......
...@@ -534,14 +534,6 @@ struct WLDAP32_berval ** CDECL ldap_get_values_lenW( LDAP *, LDAPMessage *, WCHA ...@@ -534,14 +534,6 @@ struct WLDAP32_berval ** CDECL ldap_get_values_lenW( LDAP *, LDAPMessage *, WCHA
ULONG map_error( int ) DECLSPEC_HIDDEN; ULONG map_error( int ) DECLSPEC_HIDDEN;
static inline char *strdupU( const char *src )
{
char *dst;
if (!src) return NULL;
if ((dst = malloc( strlen( src ) + 1 ))) strcpy( dst, src );
return dst;
}
static inline char *strWtoU( const WCHAR *str ) static inline char *strWtoU( const WCHAR *str )
{ {
char *ret = NULL; char *ret = NULL;
...@@ -1314,7 +1306,7 @@ static inline char **strarrayUtoU( char **strarray ) ...@@ -1314,7 +1306,7 @@ static inline char **strarrayUtoU( char **strarray )
{ {
char **p = strarray, **q = ret; char **p = strarray, **q = ret;
while (*p) *q++ = strdupU( *p++ ); while (*p) *q++ = strdup( *p++ );
*q = NULL; *q = NULL;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment