diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:50:37 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:50:37 +0000 |
commit | f55a958ff2251f0061ab907157c99a350e56025f (patch) | |
tree | 244ee844d1a240d9566865667c7f77a3c3fb5100 /apt-pkg/contrib/mmap.cc | |
parent | 578bfd0aed2ec993f4ad85fa6a7094a852261422 (diff) |
Checkpoint
Author: jgg
Date: 1998-07-04 05:57:34 GMT
Checkpoint
Diffstat (limited to 'apt-pkg/contrib/mmap.cc')
-rw-r--r-- | apt-pkg/contrib/mmap.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 85cac1cca..9febc5cdd 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: mmap.cc,v 1.1 1998/07/02 02:58:13 jgg Exp $ +// $Id: mmap.cc,v 1.2 1998/07/04 05:57:42 jgg Exp $ /* ###################################################################### MMap Class - Provides 'real' mmap or a faked mmap using read(). @@ -142,11 +142,14 @@ DynamicMMap::~DynamicMMap() /*}}}*/ // DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space /*{{{*/ // --------------------------------------------------------------------- -/* */ -unsigned long DynamicMMap::RawAllocate(unsigned long Size) +/* This allocates a block of memory aligned to the given size */ +unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln) { unsigned long Result = iSize; - iSize += Size; + if (Aln != 0) + Result += Aln - (iSize%Aln); + + iSize = Result + Size; // Just in case error check if (Result > WorkSpace) @@ -154,7 +157,6 @@ unsigned long DynamicMMap::RawAllocate(unsigned long Size) _error->Error("Dynamic MMap ran out of room"); return 0; } - return Result; } /*}}}*/ @@ -194,9 +196,9 @@ unsigned long DynamicMMap::Allocate(unsigned long ItemSize) if (I->Count == 0) { I->Count = 20*1024/ItemSize; - I->Start = RawAllocate(I->Count*ItemSize); + I->Start = RawAllocate(I->Count*ItemSize,ItemSize); } - + I->Count--; unsigned long Result = I->Start; I->Start += ItemSize; |