From 120534222c4feb7a562f29770babfe3a8c9b4280 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 8 Aug 1999 00:02:05 +0000 Subject: [PATCH] Replace bubble move with SAFEMEMCPY --- servers/slapd/back-bdb2/idl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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( -- 2.39.5