[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / MEM_SAP.cpp
blob6f18b7abe1cc139ed9455d78f2d31ad20da15e7d
1 // $Id: MEM_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #include "ace/MEM_SAP.h"
5 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
7 #if !defined (__ACE_INLINE__)
8 #include "ace/MEM_SAP.inl"
9 #endif /* __ACE_INLINE__ */
11 ACE_RCSID(ace, MEM_SAP, "$Id: MEM_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $")
13 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
15 ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP)
17 void
18 ACE_MEM_SAP::dump (void) const
20 #if defined (ACE_HAS_DUMP)
21 ACE_TRACE ("ACE_MEM_SAP::dump");
23 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
24 if (this->shm_malloc_ != 0)
25 this->shm_malloc_->dump ();
26 else
27 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_MEM_SAP uninitialized.\n")));
28 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
29 #endif /* ACE_HAS_DUMP */
32 ACE_MEM_SAP::ACE_MEM_SAP (void)
33 : handle_ (ACE_INVALID_HANDLE),
34 shm_malloc_ (0)
36 // ACE_TRACE ("ACE_MEM_SAP::ACE_MEM_SAP");
39 ACE_MEM_SAP::~ACE_MEM_SAP (void)
41 // ACE_TRACE ("ACE_MEM_SAP::~ACE_MEM_SAP");
42 delete this->shm_malloc_;
45 int
46 ACE_MEM_SAP::fini ()
48 ACE_TRACE ("ACE_MEM_SAP::fini");
50 return this->close_shm_malloc ();
53 int
54 ACE_MEM_SAP::create_shm_malloc (const ACE_TCHAR *name,
55 MALLOC_OPTIONS *options)
57 ACE_TRACE ("ACE_MEM_SAP::create_shm_malloc");
59 if (this->shm_malloc_ != 0)
60 return -1; // already initialized.
62 ACE_NEW_RETURN (this->shm_malloc_,
63 MALLOC_TYPE (name,
65 options),
66 -1);
68 if (this->shm_malloc_->bad () != 0)
70 this->shm_malloc_->remove (); // Cleanup OS resources
71 delete this->shm_malloc_;
72 this->shm_malloc_ = 0;
73 return -1;
76 return 0;
79 int
80 ACE_MEM_SAP::close_shm_malloc (void)
82 ACE_TRACE ("ACE_MEM_SAP::close_shm_malloc");
84 int retv = -1;
86 if (this->shm_malloc_ != 0)
87 this->shm_malloc_->release (1);
89 delete this->shm_malloc_;
90 this->shm_malloc_ = 0;
92 return retv;
95 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
97 ACE_END_VERSIONED_NAMESPACE_DECL