]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/string.c
Fix ldap_rename parameter order (ITS#387)
[openldap] / libraries / libldap / string.c
index e2d142d958344f8ab92a01adb26a91c07a99f112..cd9994ad0601a6ae96c145bd5ad84f42521e3330 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenLDAP$ */
 /*
  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
@@ -5,9 +6,10 @@
 
 #include "portable.h"
 
-#include <stdlib.h>
+#include <ac/stdlib.h>
 #include <ac/string.h>
 #include <ac/time.h>
+#include <ac/ctype.h>
 
 #include "ldap-int.h"
 
@@ -105,15 +107,27 @@ char *
 }
 
 char *
-(ldap_int_strdup)( const char *s )
+ldap_pvt_str2upper( char *str )
 {
-       char    *p;
-       size_t  len = strlen( s ) + 1;
+       char    *s;
 
-       if ( (p = (char *) LDAP_MALLOC( len )) == NULL ) {
-               return( NULL );
+       /* to upper */
+       for ( s = str; *s; s++ ) {
+               *s = TOUPPER( (unsigned char) *s );
        }
 
-       memcpy( p, s, len );
-       return( p );
-}
\ No newline at end of file
+       return( str );
+}
+
+char *
+ldap_pvt_str2lower( char *str )
+{
+       char    *s;
+
+       /* to lower */
+       for ( s = str; *s; s++ ) {
+               *s = TOLOWER( (unsigned char) *s );
+       }
+
+       return( str );
+}