diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-04-13 12:26:02 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-04-13 12:26:02 +0000 |
commit | 9560ce25f1faa97709827d78c1314c2c6c5acde1 (patch) | |
tree | 66e0c8f786c7ac33181de7e24bd8d9bcf2c97b6a /ace/Malloc_T.i | |
parent | 15521b4ca7fec6a65aa6939e254e43f7b1386859 (diff) | |
download | ATCD-9560ce25f1faa97709827d78c1314c2c6c5acde1.tar.gz |
ChangeLogTag:Fri Apr 13 05:30:04 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
Diffstat (limited to 'ace/Malloc_T.i')
-rw-r--r-- | ace/Malloc_T.i | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ace/Malloc_T.i b/ace/Malloc_T.i index 28c943ba08b..dbe502de44b 100644 --- a/ace/Malloc_T.i +++ b/ace/Malloc_T.i @@ -36,6 +36,29 @@ ACE_Cached_Allocator<T, ACE_LOCK>::malloc (size_t nbytes) return this->free_list_.remove ()->addr (); } +template <class T, class ACE_LOCK> ACE_INLINE void * +ACE_Cached_Allocator<T, ACE_LOCK>::calloc (size_t nbytes, + char initial_value) +{ + // Check if size requested fits within pre-determined size. + if (nbytes > sizeof (T)) + return NULL; + + // addr() call is really not absolutely necessary because of the way + // ACE_Cached_Mem_Pool_Node's internal structure arranged. + void *ptr = this->free_list_.remove ()->addr (); + ACE_OS::memset (ptr, initial_value, sizeof (T)); + return ptr; +} + +template <class T, class ACE_LOCK> ACE_INLINE void * +ACE_Cached_Allocator<T, ACE_LOCK>::calloc (size_t, + size_t, + char) +{ + ACE_NOTSUP_RETURN (0); +} + template <class T, class ACE_LOCK> ACE_INLINE void ACE_Cached_Allocator<T, ACE_LOCK>::free (void * ptr) { |