diff options
author | Bram Moolenaar <Bram@vim.org> | 2007-05-11 18:15:45 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2007-05-11 18:15:45 +0000 |
commit | fe265ff56ffc4f8192c3f47ca24c4c7fd596623a (patch) | |
tree | d47c29739cea6a8b0a8eebfce58bf614390c2fa0 | |
parent | 060f1f08b3128f60b0f55eebe9818f81bf7e28c8 (diff) | |
download | vim-git-fe265ff56ffc4f8192c3f47ca24c4c7fd596623a.tar.gz |
updated for version 7.1b-002v7.1b.002
-rw-r--r-- | src/memfile.c | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/memfile.c b/src/memfile.c index f1e85fc28..d0dd8deef 100644 --- a/src/memfile.c +++ b/src/memfile.c @@ -190,7 +190,25 @@ mf_open(fname, flags) mfp->mf_blocknr_min = -1; mfp->mf_neg_count = 0; mfp->mf_infile_count = mfp->mf_blocknr_max; - mfp->mf_used_count_max = p_mm * 1024 / mfp->mf_page_size; + + /* + * Compute maximum number of pages ('maxmem' is in Kbyte): + * 'mammem' * 1Kbyte / page-size-in-bytes. + * Avoid overflow by first reducing page size as much as possible. + */ + { + int shift = 10; + unsigned page_size = mfp->mf_page_size; + + while (shift > 0 && (page_size & 1) == 0) + { + page_size = page_size >> 1; + --shift; + } + mfp->mf_used_count_max = (p_mm << shift) / page_size; + if (mfp->mf_used_count_max < 10) + mfp->mf_used_count_max = 10; + } return mfp; } diff --git a/src/version.c b/src/version.c index c0f9b4b69..17966651f 100644 --- a/src/version.c +++ b/src/version.c @@ -667,6 +667,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2, +/**/ 1, /**/ 0 |