From f55a958ff2251f0061ab907157c99a350e56025f Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:50:37 +0000 Subject: Checkpoint Author: jgg Date: 1998-07-04 05:57:34 GMT Checkpoint --- apt-pkg/contrib/fileutl.cc | 4 ++-- apt-pkg/contrib/mmap.cc | 16 +++++++++------- apt-pkg/contrib/mmap.h | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 6048ff0bb..6c6441ef6 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: fileutl.cc,v 1.1 1998/07/02 02:58:13 jgg Exp $ +// $Id: fileutl.cc,v 1.2 1998/07/04 05:57:41 jgg Exp $ /* ###################################################################### File Utilities @@ -14,7 +14,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include +#include #include #include 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; diff --git a/apt-pkg/contrib/mmap.h b/apt-pkg/contrib/mmap.h index 096304177..c7ddf685d 100644 --- a/apt-pkg/contrib/mmap.h +++ b/apt-pkg/contrib/mmap.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: mmap.h,v 1.1 1998/07/02 02:58:13 jgg Exp $ +// $Id: mmap.h,v 1.2 1998/07/04 05:57:43 jgg Exp $ /* ###################################################################### MMap Class - Provides 'real' mmap or a faked mmap using read(). @@ -79,7 +79,7 @@ class DynamicMMap : public MMap public: // Allocation - unsigned long RawAllocate(unsigned long Size); + unsigned long RawAllocate(unsigned long Size,unsigned long Aln = 0); unsigned long Allocate(unsigned long ItemSize); unsigned long WriteString(const char *String,unsigned long Len = 0); inline unsigned long WriteString(string S) {return WriteString(S.begin(),S.size());}; -- cgit v1.2.3