From: Kurt Zeilenga Date: Sun, 8 Aug 1999 00:02:05 +0000 (+0000) Subject: Replace bubble move with SAFEMEMCPY X-Git-Tag: TWEB_OL_BASE~251 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=120534222c4feb7a562f29770babfe3a8c9b4280;p=openldap Replace bubble move with SAFEMEMCPY --- diff --git a/servers/slapd/back-bdb2/idl.c b/servers/slapd/back-bdb2/idl.c index 3c75278475..e5a2867c5b 100644 --- a/servers/slapd/back-bdb2/idl.c +++ b/servers/slapd/back-bdb2/idl.c @@ -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(