summaryrefslogtreecommitdiff
path: root/ace/Malloc_T.i
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-04-08 21:58:51 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-04-08 21:58:51 +0000
commit331b41f32e1071730d8fb949e4316eb8db2e2f30 (patch)
tree0cb6e6d290c14152a8c3a5da8476990b2d26f40e /ace/Malloc_T.i
parent64b3b4027e1242b0266ca56b15ecbca213838829 (diff)
downloadATCD-331b41f32e1071730d8fb949e4316eb8db2e2f30.tar.gz
*** empty log message ***
Diffstat (limited to 'ace/Malloc_T.i')
-rw-r--r--ace/Malloc_T.i126
1 files changed, 126 insertions, 0 deletions
diff --git a/ace/Malloc_T.i b/ace/Malloc_T.i
index c6ca4e7fad0..04870225a64 100644
--- a/ace/Malloc_T.i
+++ b/ace/Malloc_T.i
@@ -184,3 +184,129 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::protect (void *addr, size_t len, int flags
return this->memory_pool_.protect (addr, len, flags);
}
+template <size_t POOL_SIZE> ACE_INLINE
+ACE_Static_Allocator<POOL_SIZE>::ACE_Static_Allocator (void)
+ : offset_ (0)
+{
+}
+
+template <size_t POOL_SIZE> ACE_INLINE void *
+ACE_Static_Allocator<POOL_SIZE>::malloc (size_t nbytes)
+{
+ if (this->offset_ + nbytes > POOL_SIZE)
+ {
+ errno = ENOMEM;
+ return 0;
+ }
+ else
+ {
+ char *ptr = &this->pool_[this->offset_];
+
+ this->offset_ += nbytes;
+
+ return (void *) ptr;
+ }
+}
+
+template <size_t POOL_SIZE> ACE_INLINE void *
+ACE_Static_Allocator<POOL_SIZE>::calloc (size_t nbytes,
+ char initial_value)
+{
+ void *ptr = this->malloc (nbytes);
+
+ ACE_OS::memset (ptr, initial_value, nbytes);
+ return (void *) ptr;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE void
+ACE_Static_Allocator<POOL_SIZE>::free (void *ptr)
+{
+ // no-op!
+ // @@ We could check to see if ptr is within our pool?!
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::remove (void)
+{
+ return -1;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::bind (const char *, void *, int)
+{
+ return -1;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::trybind (const char *, void *&)
+{
+ return -1;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::find (const char *, void *&)
+{
+ return -1;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::find (const char *)
+{
+ return -1;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::unbind (const char *)
+{
+ return -1;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::unbind (const char *, void *&)
+{
+ return -1;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::sync (ssize_t, int)
+{
+ return -1;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::sync (void *, size_t, int)
+{
+ return -1;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::protect (ssize_t, int)
+{
+ return -1;
+}
+
+template <size_t POOL_SIZE> ACE_INLINE int
+ACE_Static_Allocator<POOL_SIZE>::protect (void *, size_t, int)
+{
+ return -1;
+}
+
+#if defined (ACE_HAS_MALLOC_STATS)
+template <size_t POOL_SIZE> ACE_INLINE void
+ACE_Static_Allocator<POOL_SIZE>::print_stats (void) const
+{
+}
+#endif /* ACE_HAS_MALLOC_STATS */
+
+template <size_t POOL_SIZE> ACE_INLINE void
+ACE_Static_Allocator<POOL_SIZE>::dump (void) const
+{
+ ACE_TRACE ("ACE_Static_Allocator<POOL_SIZE>::dump");
+
+ ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\noffset_ = %d\n"), this->offset_));
+ ACE_HEX_DUMP ((LM_DEBUG, this->pool_, POOL_SIZE));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\n")));
+
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+}