ITS#4186 hdb_idl_append() must not alter the tmp input.

This commit is contained in:
Howard Chu 2005-11-20 22:02:41 +00:00
parent 210638e3c5
commit 3429c5a566

View File

@ -1311,7 +1311,7 @@ int bdb_idl_append_one( ID *ids, ID id )
*/
int bdb_idl_append( ID *a, ID *b )
{
ID ida, idb, tmp;
ID ida, idb, tmp, swap = 0;
if ( BDB_IDL_IS_ZERO( b ) ) {
return 0;
@ -1333,6 +1333,7 @@ int bdb_idl_append( ID *a, ID *b )
}
if ( b[0] > 1 && ida > idb ) {
swap = idb;
a[a[0]] = idb;
b[b[0]] = ida;
}
@ -1351,6 +1352,9 @@ int bdb_idl_append( ID *a, ID *b )
AC_MEMCPY(a+a[0]+1, b+2, i * sizeof(ID));
a[0] += i;
}
if ( swap ) {
b[b[0]] = swap;
}
return 0;
}