X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=libraries%2Flibldap%2Fstring.c;h=df8069ccaabe80c4e9da084decf7e1db1f711032;hb=e2cca72bdc02a1d4bbf75ec2c98b9105e425a558;hp=e2d142d958344f8ab92a01adb26a91c07a99f112;hpb=2e5a52414a0d29382b971bce0450dfd6a8ff6b54;p=openldap diff --git a/libraries/libldap/string.c b/libraries/libldap/string.c index e2d142d958..df8069ccaa 100644 --- a/libraries/libldap/string.c +++ b/libraries/libldap/string.c @@ -1,13 +1,20 @@ +/* $OpenLDAP$ */ /* - * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ +/* + * Locale-specific 1-byte character versions + * See utf-8.c for UTF-8 versions + */ + #include "portable.h" -#include +#include #include #include +#include #include "ldap-int.h" @@ -91,29 +98,27 @@ char *(ldap_pvt_strtok)( char *str, const char *delim, char **pos ) } char * -(ldap_pvt_strdup)( const char *s ) +ldap_pvt_str2upper( char *str ) { - char *p; - size_t len = strlen( s ) + 1; + char *s; - if ( (p = (char *) malloc( len )) == NULL ) { - return( NULL ); + /* to upper */ + for ( s = str; *s; s++ ) { + *s = TOUPPER( (unsigned char) *s ); } - memcpy( p, s, len ); - return( p ); + return( str ); } char * -(ldap_int_strdup)( const char *s ) +ldap_pvt_str2lower( char *str ) { - char *p; - size_t len = strlen( s ) + 1; + char *s; - if ( (p = (char *) LDAP_MALLOC( len )) == NULL ) { - return( NULL ); + /* to lower */ + for ( s = str; *s; s++ ) { + *s = TOLOWER( (unsigned char) *s ); } - memcpy( p, s, len ); - return( p ); -} \ No newline at end of file + return( str ); +}