X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=libraries%2Flibldap%2Fstring.c;h=aaf76c609d6f45174d96c833c94d0385fabc3c05;hb=709ce4fa6c0a8aea66c4b6e15bf42aa3352ad2e2;hp=494248531ecade80d5bfc09f19fd1072a4a55288;hpb=55fa595f5626218a736295021c8053e848489d1f;p=openldap diff --git a/libraries/libldap/string.c b/libraries/libldap/string.c index 494248531e..aaf76c609d 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-2002 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 "ldap-int.h" @@ -91,15 +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 *s; + + /* to upper */ + for ( s = str; *s; s++ ) { + *s = TOUPPER( (unsigned char) *s ); + } + + return( str ); +} + +char * +ldap_pvt_str2lower( char *str ) { - char *p; - size_t len = strlen( s ) + 1; + char *s; - if ( (p = (char *) malloc( len )) == NULL ) { - return( NULL ); + /* to lower */ + for ( s = str; *s; s++ ) { + *s = TOLOWER( (unsigned char) *s ); } - memcpy( p, s, len ); - return( p ); + return( str ); }