]> git.sur5r.net Git - openldap/commitdiff
Fix attribute sorting
authorHoward Chu <hyc@openldap.org>
Thu, 12 May 2005 03:24:49 +0000 (03:24 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 12 May 2005 03:24:49 +0000 (03:24 +0000)
servers/slapd/entry.c

index ffef1579404fb11023bd3807d16b0420f36e14e2..e83ed0000d1cfe2f3fb7df18c6556cbff45ddb55 100644 (file)
@@ -181,24 +181,23 @@ str2entry2( char *s, int checkvals )
                int fv;
 
                for (i=0; i<lines; i++) {
-                       k = i;
                        for ( j=i+1; j<lines; j++ ) {
                                if ( bvmatch( type+i, type+j )) {
                                        /* out of order, move intervening attributes down */
-                                       if ( j != k+1 ) {
-                                               int l;
+                                       if ( j != i+1 ) {
                                                bv = vals[j];
                                                fv = freeval[j];
-                                               for ( l=j; l>k; l-- ) {
-                                                       type[l] = type[l-1];
-                                                       vals[l] = vals[l-1];
-                                                       freeval[l] = freeval[l-1];
+                                               for ( k=j; k>i; k-- ) {
+                                                       type[k] = type[k-1];
+                                                       vals[k] = vals[k-1];
+                                                       freeval[k] = freeval[k-1];
                                                }
-                                               type[l] = type[i];
-                                               vals[l] = bv;
-                                               freeval[l] = fv;
+                                               k++;
+                                               type[k] = type[i];
+                                               vals[k] = bv;
+                                               freeval[k] = fv;
                                        }
-                                       i = k = j;
+                                       i++;
                                }
                        }
                }