]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/string.c
VLV clean
[openldap] / libraries / libldap / string.c
index cd9994ad0601a6ae96c145bd5ad84f42521e3330..ee275baec66cee7c47a0806484fb8e1ebde1e1ec 100644 (file)
@@ -1,9 +1,14 @@
 /* $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 <ac/stdlib.h>
@@ -92,28 +97,16 @@ char *(ldap_pvt_strtok)( char *str, const char *delim, char **pos )
        return str;
 }
 
-char *
-(ldap_pvt_strdup)( const char *s )
-{
-       char    *p;
-       size_t  len = strlen( s ) + 1;
-
-       if ( (p = (char *) malloc( len )) == NULL ) {
-               return( NULL );
-       }
-
-       memcpy( p, s, len );
-       return( p );
-}
-
 char *
 ldap_pvt_str2upper( char *str )
 {
        char    *s;
 
        /* to upper */
-       for ( s = str; *s; s++ ) {
-               *s = TOUPPER( (unsigned char) *s );
+       if ( str ) {
+               for ( s = str; *s; s++ ) {
+                       *s = TOUPPER( (unsigned char) *s );
+               }
        }
 
        return( str );
@@ -125,8 +118,10 @@ ldap_pvt_str2lower( char *str )
        char    *s;
 
        /* to lower */
-       for ( s = str; *s; s++ ) {
-               *s = TOLOWER( (unsigned char) *s );
+       if ( str ) {
+               for ( s = str; *s; s++ ) {
+                       *s = TOLOWER( (unsigned char) *s );
+               }
        }
 
        return( str );