]> git.sur5r.net Git - openldap/commitdiff
Replace bubble move with SAFEMEMCPY
authorKurt Zeilenga <kurt@openldap.org>
Sun, 8 Aug 1999 00:02:05 +0000 (00:02 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 8 Aug 1999 00:02:05 +0000 (00:02 +0000)
servers/slapd/back-bdb2/idl.c

index 3c752784753f4b09ea86a8e08cce00c6cf9f81b0..e5a2867c5b1fbf0e92ea9d1cf7f2450d8937e1d4 100644 (file)
@@ -644,10 +644,10 @@ bdb2i_idl_insert( ID_BLOCK **idl, ID id, unsigned int maxids )
                    (ID_BLOCK_NMAX(*idl) + ID_BLOCK_IDS_OFFSET) * sizeof(ID) );
        }
 
-       /* make a slot for the new id *//* XXX bubble move XXX */
-       for ( j = ID_BLOCK_NIDS(*idl); j != i; j-- ) {
-               ID_BLOCK_ID(*idl, j) = ID_BLOCK_ID(*idl, j-1);
-       }
+       /* make a slot for the new id */
+       SAFEMEMCPY( &ID_BLOCK_ID(*idl, i), &ID_BLOCK_ID(*idl, i+1),
+               ID_BLOCKS_NIDS(*idl) - i );
+
        ID_BLOCK_ID(*idl, i) = id;
        ID_BLOCK_NIDS(*idl)++;
        (void) memset(