diff options
author | jtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-10-08 00:40:05 +0000 |
---|---|---|
committer | jtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-10-08 00:40:05 +0000 |
commit | 92c2f0f52da5b946f2ffd17864be4b26127cf5ca (patch) | |
tree | 0c358f29fb0b2b9fcc910df3dc3f8482ae545986 | |
parent | 982d3bb611de036ee88f5807681ca6c8f26ca57d (diff) | |
download | ATCD-92c2f0f52da5b946f2ffd17864be4b26127cf5ca.tar.gz |
ChangeLogTag: Thu Oct 7 17:32:18 2004 J.T. Conklin <jtc@acorntoolworks.com>
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ace/Malloc_Allocator.cpp | 206 | ||||
-rw-r--r-- | ace/Malloc_Allocator.inl | 208 |
3 files changed, 211 insertions, 210 deletions
diff --git a/ChangeLog b/ChangeLog index acf60751482..6ed5ed7ebf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Oct 7 17:32:18 2004 J.T. Conklin <jtc@acorntoolworks.com> + + * ace/Malloc_Allocator.cpp: + * ace/Malloc_Allocator.inl: + + Moved all virtual methods from *.inl to *.cpp. + Thu Oct 7 16:45:21 2004 Steve Huston <shuston@riverace.com> * bin/MakeProjectCreator/config/global.features: Added uses_wchar = 0 diff --git a/ace/Malloc_Allocator.cpp b/ace/Malloc_Allocator.cpp index bfa794e1a7f..a696e4214ca 100644 --- a/ace/Malloc_Allocator.cpp +++ b/ace/Malloc_Allocator.cpp @@ -20,6 +20,7 @@ #include "ace/Guard_T.h" #include "ace/Recursive_Thread_Mutex.h" +#include "ace/Log_Msg.h" // for ACE_ASSERT ACE_RCSID (ace, Malloc_Allocator, "$Id$") @@ -138,14 +139,217 @@ ACE_New_Allocator::calloc (size_t nbytes, return (void *) ptr; } +void * +ACE_New_Allocator::calloc (size_t n_elem, size_t elem_size, char initial_value) +{ + return ACE_New_Allocator::calloc (n_elem * elem_size, initial_value); +} + void ACE_New_Allocator::free (void *ptr) { delete [] (char *) ptr; } +int +ACE_New_Allocator::remove (void) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_New_Allocator::bind (const char *, void *, int) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_New_Allocator::trybind (const char *, void *&) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_New_Allocator::find (const char *, void *&) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_New_Allocator::find (const char *) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_New_Allocator::unbind (const char *) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_New_Allocator::unbind (const char *, void *&) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_New_Allocator::sync (ssize_t, int) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_New_Allocator::sync (void *, size_t, int) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_New_Allocator::protect (ssize_t, int) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_New_Allocator::protect (void *, size_t, int) +{ + ACE_NOTSUP_RETURN (-1); +} + +#if defined (ACE_HAS_MALLOC_STATS) +void +ACE_New_Allocator::print_stats (void) const +{ +} +#endif /* ACE_HAS_MALLOC_STATS */ + +void +ACE_New_Allocator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +#endif /* ACE_HAS_DUMP */ +} + /******************************************************************************/ +void * +ACE_Static_Allocator_Base::malloc (size_t nbytes) +{ + if (this->offset_ + nbytes > this->size_) + { + errno = ENOMEM; + return 0; + } + else + { + // Record the current offset, increment the offset by the number + // of bytes requested, and return the original offset. + char *ptr = &this->buffer_[this->offset_]; + this->offset_ += nbytes; + return (void *) ptr; + } +} + +void * +ACE_Static_Allocator_Base::calloc (size_t nbytes, + char initial_value) +{ + void *ptr = this->malloc (nbytes); + + ACE_OS::memset (ptr, initial_value, nbytes); + return (void *) ptr; +} + +void * +ACE_Static_Allocator_Base::calloc (size_t n_elem, + size_t elem_size, + char initial_value) +{ + return this->calloc (n_elem * elem_size, initial_value); +} + +void +ACE_Static_Allocator_Base::free (void *ptr) +{ + // Check to see if ptr is within our pool?! + ACE_UNUSED_ARG (ptr); + ACE_ASSERT (ptr >= this->buffer_ && ptr < this->buffer_ + this->size_); +} + +int +ACE_Static_Allocator_Base::remove (void) +{ + return -1; +} + +int +ACE_Static_Allocator_Base::bind (const char *, void *, int) +{ + return -1; +} + +int +ACE_Static_Allocator_Base::trybind (const char *, void *&) +{ + return -1; +} + +int +ACE_Static_Allocator_Base::find (const char *, void *&) +{ + return -1; +} + +int +ACE_Static_Allocator_Base::find (const char *) +{ + return -1; +} + +int +ACE_Static_Allocator_Base::unbind (const char *) +{ + return -1; +} + +int +ACE_Static_Allocator_Base::unbind (const char *, void *&) +{ + return -1; +} + +int +ACE_Static_Allocator_Base::sync (ssize_t, int) +{ + return -1; +} + +int +ACE_Static_Allocator_Base::sync (void *, size_t, int) +{ + return -1; +} + +int +ACE_Static_Allocator_Base::protect (ssize_t, int) +{ + return -1; +} + +int +ACE_Static_Allocator_Base::protect (void *, size_t, int) +{ + return -1; +} + +#if defined (ACE_HAS_MALLOC_STATS) +void +ACE_Static_Allocator_Base::print_stats (void) const +{ +} +#endif /* ACE_HAS_MALLOC_STATS */ + void ACE_Static_Allocator_Base::dump (void) const { @@ -162,6 +366,4 @@ ACE_Static_Allocator_Base::dump (void) const #endif /* ACE_HAS_DUMP */ } - - #endif /* ACE_MALLOC_ALLOCATOR_CPP */ diff --git a/ace/Malloc_Allocator.inl b/ace/Malloc_Allocator.inl index e360750f9aa..7ec860c8591 100644 --- a/ace/Malloc_Allocator.inl +++ b/ace/Malloc_Allocator.inl @@ -1,214 +1,6 @@ /* -*- C++ -*- */ // $Id$ -#include "ace/os_include/os_errno.h" -#include "ace/Log_Msg.h" // for ACE_ASSERT -#include "ace/OS_NS_string.h" - -ACE_INLINE void * -ACE_New_Allocator::calloc (size_t n_elem, size_t elem_size, char initial_value) -{ - return ACE_New_Allocator::calloc (n_elem * elem_size, initial_value); -} - - -ACE_INLINE int -ACE_New_Allocator::remove (void) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_New_Allocator::bind (const char *, void *, int) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_New_Allocator::trybind (const char *, void *&) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_New_Allocator::find (const char *, void *&) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_New_Allocator::find (const char *) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_New_Allocator::unbind (const char *) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_New_Allocator::unbind (const char *, void *&) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_New_Allocator::sync (ssize_t, int) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_New_Allocator::sync (void *, size_t, int) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_New_Allocator::protect (ssize_t, int) -{ - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_New_Allocator::protect (void *, size_t, int) -{ - ACE_NOTSUP_RETURN (-1); -} - -#if defined (ACE_HAS_MALLOC_STATS) -ACE_INLINE void -ACE_New_Allocator::print_stats (void) const -{ -} -#endif /* ACE_HAS_MALLOC_STATS */ - -ACE_INLINE void -ACE_New_Allocator::dump (void) const -{ -#if defined (ACE_HAS_DUMP) -#endif /* ACE_HAS_DUMP */ -} - -ACE_INLINE void * -ACE_Static_Allocator_Base::malloc (size_t nbytes) -{ - if (this->offset_ + nbytes > this->size_) - { - errno = ENOMEM; - return 0; - } - else - { - // Record the current offset, increment the offset by the number - // of bytes requested, and return the original offset. - char *ptr = &this->buffer_[this->offset_]; - this->offset_ += nbytes; - return (void *) ptr; - } -} - -ACE_INLINE void * -ACE_Static_Allocator_Base::calloc (size_t nbytes, - char initial_value) -{ - void *ptr = this->malloc (nbytes); - - ACE_OS::memset (ptr, initial_value, nbytes); - return (void *) ptr; -} - -ACE_INLINE void * -ACE_Static_Allocator_Base::calloc (size_t n_elem, - size_t elem_size, - char initial_value) -{ - return this->calloc (n_elem * elem_size, initial_value); -} - -ACE_INLINE void -ACE_Static_Allocator_Base::free (void *ptr) -{ - // Check to see if ptr is within our pool?! - ACE_UNUSED_ARG (ptr); - ACE_ASSERT (ptr >= this->buffer_ && ptr < this->buffer_ + this->size_); -} - -ACE_INLINE int -ACE_Static_Allocator_Base::remove (void) -{ - return -1; -} - -ACE_INLINE int -ACE_Static_Allocator_Base::bind (const char *, void *, int) -{ - return -1; -} - -ACE_INLINE int -ACE_Static_Allocator_Base::trybind (const char *, void *&) -{ - return -1; -} - -ACE_INLINE int -ACE_Static_Allocator_Base::find (const char *, void *&) -{ - return -1; -} - -ACE_INLINE int -ACE_Static_Allocator_Base::find (const char *) -{ - return -1; -} - -ACE_INLINE int -ACE_Static_Allocator_Base::unbind (const char *) -{ - return -1; -} - -ACE_INLINE int -ACE_Static_Allocator_Base::unbind (const char *, void *&) -{ - return -1; -} - -ACE_INLINE int -ACE_Static_Allocator_Base::sync (ssize_t, int) -{ - return -1; -} - -ACE_INLINE int -ACE_Static_Allocator_Base::sync (void *, size_t, int) -{ - return -1; -} - -ACE_INLINE int -ACE_Static_Allocator_Base::protect (ssize_t, int) -{ - return -1; -} - -ACE_INLINE int -ACE_Static_Allocator_Base::protect (void *, size_t, int) -{ - return -1; -} - -#if defined (ACE_HAS_MALLOC_STATS) -ACE_INLINE void -ACE_Static_Allocator_Base::print_stats (void) const -{ -} -#endif /* ACE_HAS_MALLOC_STATS */ - ACE_INLINE ACE_Static_Allocator_Base::ACE_Static_Allocator_Base (char *buffer, size_t size) |