From: wessels <> Date: Tue, 11 Jan 2000 11:57:15 +0000 (+0000) Subject: DW: X-Git-Tag: SQUID_3_0_PRE1~2086 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=856ce18166b0c66fa8954bdfee456852591d051d;p=thirdparty%2Fsquid.git DW: - Fixed off-by-one bug in comparison when 'suggestion' exceeds fm->max_n_files. - Changed file_map_allocate so that it no longer sets the available bitmap before returning. Now its the job of the other end to set the bitmap. "allocate" is probably no longer a good descriptive name. --- diff --git a/src/filemap.cc b/src/filemap.cc index 0392d35cf6..2e5e1963f7 100644 --- a/src/filemap.cc +++ b/src/filemap.cc @@ -1,6 +1,6 @@ /* - * $Id: filemap.cc,v 1.32 1999/12/01 04:28:07 wessels Exp $ + * $Id: filemap.cc,v 1.33 2000/01/11 04:57:15 wessels Exp $ * * DEBUG: section 8 Swap File Bitmap * AUTHOR: Harvest Derived @@ -120,11 +120,10 @@ file_map_allocate(fileMap * fm, int suggestion) int word; int bit; int count; - if (suggestion > fm->max_n_files) + if (suggestion >= fm->max_n_files) suggestion = 0; - if (!file_map_bit_test(fm, suggestion)) { - return file_map_bit_set(fm, suggestion); - } + if (!file_map_bit_test(fm, suggestion)) + return suggestion; word = suggestion >> LONG_BIT_SHIFT; for (count = 0; count < fm->nwords; count++) { if (fm->file_map[word] != ALL_ONES)