summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:50:37 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:50:37 +0000
commitf55a958ff2251f0061ab907157c99a350e56025f (patch)
tree244ee844d1a240d9566865667c7f77a3c3fb5100 /apt-pkg/contrib
parent578bfd0aed2ec993f4ad85fa6a7094a852261422 (diff)
Checkpoint
Author: jgg Date: 1998-07-04 05:57:34 GMT Checkpoint
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/fileutl.cc4
-rw-r--r--apt-pkg/contrib/mmap.cc16
-rw-r--r--apt-pkg/contrib/mmap.h4
3 files changed, 13 insertions, 11 deletions
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 <fileutl.h>
+#include <pkglib/fileutl.h>
#include <pkglib/error.h>
#include <unistd.h>
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());};