summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-07-26 18:43:33 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-07-26 18:43:33 +0000
commitd7dcf652235387b069e6cf766e52d5171ec33822 (patch)
tree06013960e2e9d5697dbe97e9c74fc6ba65999d8e
parent36f6e6a10055893d7cbb315604cc9998048e964b (diff)
downloadATCD-d7dcf652235387b069e6cf766e52d5171ec33822.tar.gz
*** empty log message ***
-rw-r--r--ace/Free_List.i5
-rw-r--r--ace/Malloc_T.cpp8
-rw-r--r--ace/Malloc_T.i12
3 files changed, 12 insertions, 13 deletions
diff --git a/ace/Free_List.i b/ace/Free_List.i
index 6f30a61eb33..93574c29bf1 100644
--- a/ace/Free_List.i
+++ b/ace/Free_List.i
@@ -8,6 +8,7 @@ template <class T, class LOCK> ACE_INLINE void
ACE_Locked_Free_List<T, LOCK>::add (T *element)
{
ACE_MT (ACE_GUARD (LOCK, ace_mon, this->mutex_));
+
// Check to see that we not at the high water mark.
if (this->mode_ == ACE_PURE_FREE_LIST
|| this->size_ >= this->hwm_)
@@ -20,12 +21,11 @@ ACE_Locked_Free_List<T, LOCK>::add (T *element)
delete element;
}
-
// Takes a element off the freelist and returns it. It creates <inc>
// new elements if we are allowed to do it and the size is at the low
// water mark.
-template <class T, class LOCK> ACE_INLINE T*
+template <class T, class LOCK> ACE_INLINE T *
ACE_Locked_Free_List<T, LOCK>::remove (void)
{
ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, 0));
@@ -55,7 +55,6 @@ ACE_Locked_Free_List<T, LOCK>::size (void)
return this->size_;
}
-
// Resizes the free list to <newsize>
template <class T, class LOCK> ACE_INLINE void
diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp
index 01061f66378..2083bce793d 100644
--- a/ace/Malloc_T.cpp
+++ b/ace/Malloc_T.cpp
@@ -16,19 +16,19 @@ ACE_Cached_Allocator<T, LOCK>::ACE_Cached_Allocator (size_t n_chunks)
: pool_ (0),
free_list_ (ACE_PURE_FREE_LIST)
{
- this->pool_ = (T *) new char[ n_chunks * sizeof (T[1])];
+ this->pool_ = (T *) new char[n_chunks * sizeof (*T)];
// ERRNO could be lost because this is within ctor
for (size_t c = 0 ; c < n_chunks ; c++)
this->free_list_.add (new (&this->pool_ [c]) ACE_Cached_Mem_Pool_Node<T>);
- // put into free list using placement contructor, no real memory
- // allocation in the above new
+ // Put into free list using placement contructor, no real memory
+ // allocation in the above new.
}
template <class T, class LOCK>
ACE_Cached_Allocator<T, LOCK>::~ACE_Cached_Allocator (void)
{
- delete[] this->pool_;
+ delete [] this->pool_;
}
ACE_ALLOC_HOOK_DEFINE(ACE_Malloc)
diff --git a/ace/Malloc_T.i b/ace/Malloc_T.i
index ae88e10d0fa..24285fd1239 100644
--- a/ace/Malloc_T.i
+++ b/ace/Malloc_T.i
@@ -3,25 +3,25 @@
// Malloc_T.i
-template <class T> T *
+template <class T> T * ACE_INLINE
ACE_Cached_Mem_Pool_Node<T>::addr (void)
{
- return (T*) this;
+ return (T *) this;
}
-template <class T> ACE_Cached_Mem_Pool_Node<T> *
+template <class T> ACE_INLINE ACE_Cached_Mem_Pool_Node<T> *
ACE_Cached_Mem_Pool_Node<T>::get_next (void)
{
return this->next_;
}
-template <class T> void
+template <class T> ACE_INLINE void
ACE_Cached_Mem_Pool_Node<T>::set_next (ACE_Cached_Mem_Pool_Node<T> *ptr)
{
this->next_ = ptr;
}
-template <class T, class LOCK> void *
+template <class T, class LOCK> ACE_INLINE void *
ACE_Cached_Allocator<T, LOCK>::malloc (size_t nbytes)
{
// Check if size requested fits within pre-determined size.
@@ -33,7 +33,7 @@ ACE_Cached_Allocator<T, LOCK>::malloc (size_t nbytes)
return this->free_list_.remove ()->addr ();
}
-template <class T, class LOCK> void
+template <class T, class LOCK> ACE_INLINE void
ACE_Cached_Allocator<T, LOCK>::free (void * ptr)
{
this->free_list_.add ((ACE_Cached_Mem_Pool_Node<T> *) ptr) ;