]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Import value_cmp fix from -devel.
authorKurt Zeilenga <kurt@openldap.org>
Sun, 20 Dec 1998 20:44:41 +0000 (20:44 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 20 Dec 1998 20:44:41 +0000 (20:44 +0000)
servers/slapd/proto-slap.h
servers/slapd/value.c

index 412174f6bf5716d97f87da0ecff8e31b4821790d..87a570fb6dffe5aaa55b5bb9ff61dfe65a894641 100644 (file)
@@ -208,8 +208,6 @@ int value_add LDAP_P(( struct berval ***vals, struct berval **addvals ));
 void value_normalize LDAP_P(( char *s, int syntax ));
 int value_cmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax,
        int normalize ));
-int value_ncmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax, int len,
-       int normalize ));
 int value_find LDAP_P(( struct berval **vals, struct berval *v, int syntax,
        int normalize ));
 
index c9e6fbb5774a1560f88990c63cab8a1e528fed5b..bb6b7e620b62c13648992eaa592e1af27dd349cc 100644 (file)
@@ -1,12 +1,16 @@
 /* value.c - routines for dealing with values */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
 #include <sys/stat.h>
-#include "portable.h"
+
 #include "slap.h"
 
 int
@@ -99,8 +103,6 @@ value_normalize(
        *d = '\0';
 }
 
-#define MIN( a, b )    (a < b ? a : b )
-
 int
 value_cmp(
     struct berval      *v1,
@@ -133,8 +135,8 @@ value_cmp(
                break;
 
        case SYNTAX_BIN:
-               rc = memcmp( v1->bv_val, v2->bv_val, MIN( v1->bv_len,
-                   v2->bv_len ) );
+               rc = ( v1->bv_len == v2->bv_len ) ? memcmp( v1->bv_val, 
+                   v2->bv_val, v1->bv_len ) : v1->bv_len - v2->bv_len ;
                break;
        }
 
@@ -148,50 +150,6 @@ value_cmp(
        return( rc );
 }
 
-int
-value_ncmp(
-    struct berval      *v1,
-    struct berval      *v2,
-    int                        syntax,
-    int                        len,
-    int                        normalize
-)
-{
-       int     rc;
-
-       if ( normalize & 1 ) {
-               v1 = ber_bvdup( v1 );
-               value_normalize( v1->bv_val, syntax );
-       }
-       if ( normalize & 2 ) {
-               v2 = ber_bvdup( v2 );
-               value_normalize( v2->bv_val, syntax );
-       }
-
-       switch ( syntax ) {
-       case SYNTAX_CIS:
-       case (SYNTAX_CIS | SYNTAX_TEL):
-               rc = strncasecmp( v1->bv_val, v2->bv_val, len );
-               break;
-
-       case SYNTAX_CES:
-               rc = strncmp( v1->bv_val, v2->bv_val, len );
-               break;
-
-       case SYNTAX_BIN:
-               rc = memcmp( v1->bv_val, v2->bv_val, len );
-       }
-
-       if ( normalize & 1 ) {
-               ber_bvfree( v1 );
-       }
-       if ( normalize & 2 ) {
-               ber_bvfree( v2 );
-       }
-
-       return( rc );
-}
-
 int
 value_find(
     struct berval      **vals,