Module: wine Branch: master Commit: b072bb494b31c5dbfde6039716bb1ce278f0da37 URL: https://gitlab.winehq.org/wine/wine/-/commit/b072bb494b31c5dbfde6039716bb1ce...
Author: Alex Henrie alexhenrie24@gmail.com Date: Sun Nov 27 17:02:03 2022 -0700
wldap32: Use the strdup function instead of reimplementing it.
---
dlls/wldap32/ber.c | 2 +- dlls/wldap32/control.c | 2 +- dlls/wldap32/init.c | 6 +++--- dlls/wldap32/winldap_private.h | 10 +--------- 4 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/dlls/wldap32/ber.c b/dlls/wldap32/ber.c index 07013ad35ae..d3e8adc8433 100644 --- a/dlls/wldap32/ber.c +++ b/dlls/wldap32/ber.c @@ -266,7 +266,7 @@ ULONG WINAPIV WLDAP32_ber_scanf( WLDAP32_BerElement *ber, char *fmt, ... ) { char *str, **ptr = va_arg( list, char ** ); if ((ret = ber_scanf( BER(ber), new_fmt, &str )) == -1) break; - *ptr = strdupU( str ); + *ptr = strdup( str ); ldap_memfree( str ); break; } diff --git a/dlls/wldap32/control.c b/dlls/wldap32/control.c index ba1cefe9a45..131ea4dad64 100644 --- a/dlls/wldap32/control.c +++ b/dlls/wldap32/control.c @@ -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) { - ret->ldctl_oid = strdupU(control->ldctl_oid); + ret->ldctl_oid = strdup( control->ldctl_oid ); bv_val_dup( &control->ldctl_value, &ret->ldctl_value ); ret->ldctl_iscritical = control->ldctl_iscritical; ldap_control_freeA( control ); diff --git a/dlls/wldap32/init.c b/dlls/wldap32/init.c index 512c558936d..b8010a2da12 100644 --- a/dlls/wldap32/init.c +++ b/dlls/wldap32/init.c @@ -36,7 +36,7 @@ static char **split_hostnames( const char *hostnames ) char **res, *str, *p, *q; unsigned int i = 0;
- str = strdupU( hostnames ); + str = strdup( hostnames ); if (!str) return NULL;
p = str; @@ -72,7 +72,7 @@ static char **split_hostnames( const char *hostnames ) if (isspace( *p )) { *p = '\0'; p++; - res[i] = strdupU( q ); + res[i] = strdup( q ); if (!res[i]) goto oom; i++;
@@ -82,7 +82,7 @@ static char **split_hostnames( const char *hostnames ) } else { - res[i] = strdupU( q ); + res[i] = strdup( q ); if (!res[i]) goto oom; i++; } diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h index 886c7933e9f..2902daea974 100644 --- a/dlls/wldap32/winldap_private.h +++ b/dlls/wldap32/winldap_private.h @@ -534,14 +534,6 @@ struct WLDAP32_berval ** CDECL ldap_get_values_lenW( LDAP *, LDAPMessage *, WCHA
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 ) { char *ret = NULL; @@ -1314,7 +1306,7 @@ static inline char **strarrayUtoU( char **strarray ) { char **p = strarray, **q = ret;
- while (*p) *q++ = strdupU( *p++ ); + while (*p) *q++ = strdup( *p++ ); *q = NULL; } }