From ab21f9be769947b724fa45f8aee9cf1a3134ddc9 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Tue, 6 Apr 2004 23:03:51 +0000 Subject: [PATCH] buffer intersection check should use > instead of >= (spotted by Arkady) small optimization -- the segment in bp == firstbuf is always the same so we just need to compare offsets. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@843 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/blockio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/blockio.c b/kernel/blockio.c index 395ed0f..89a8d87 100644 --- a/kernel/blockio.c +++ b/kernel/blockio.c @@ -481,14 +481,15 @@ void AllocateHMASpace (size_t lowbuffer, size_t highbuffer) do { - if (FP_OFF(bp) < highbuffer && FP_OFF(bp+1) >= lowbuffer) + /* check if buffer intersects with requested area */ + if (FP_OFF(bp) < highbuffer && FP_OFF(bp+1) > lowbuffer) { flush1(bp); /* unlink bp from buffer chain */ b_prev(bp)->b_next = bp->b_next; b_next(bp)->b_prev = bp->b_prev; - if (bp == firstbuf) + if (FP_OFF(bp) == FP_OFF(firstbuf)) firstbuf = b_next(bp); LoL_nbuffers--; }