9#elif defined(__WINNT__)
22#define __strlen(s) wcslen(s)
23#define __strcpy(d, s) wcscpy(d, s)
24#define __strncpy(d, s, n) wcsncpy(d, s, n)
27#define __DCL_ASSERT_N(expr)
29#if __DCL_HAVE_THIS_FILE__
39 pthread_mutex_init(&__mutex,
NULL);
40#elif defined(__WINNT__)
41 InitializeCriticalSection(&__cs);
49 pthread_mutex_destroy(&__mutex);
50#elif defined(__WINNT__)
51 DeleteCriticalSection(&__cs);
58 pthread_mutex_lock(&__mutex);
59#elif defined(__WINNT__)
60 EnterCriticalSection(&__cs);
67 pthread_mutex_unlock(&__mutex);
68#elif defined(__WINNT__)
69 LeaveCriticalSection(&__cs);
73#if __DCL_HAVE_ALLOC_DEBUG
74size_t AllocList::Node::SIZE()
77 size_t r =
sizeof(Node) %
sizeof(
void*);
79 return sizeof(Node) +
sizeof(
void*) -
r;
84void* AllocList::Node::DATA()
const
86 return (
char*)
this + Node::SIZE();
89void AllocList::Node::setFilename(
const char_t* _filename)
94 if (len > __DCL_DEBUG_PATH_MAX) {
97 _filename += len - __DCL_DEBUG_PATH_MAX + 8;
105AllocList::Node* AllocList::allocNode(
115 Node* newNode = (Node*)malloc(Node::SIZE() + _size);
118 newNode->check = _check;
119 newNode->func = _func;
122 newNode->setFilename(_filename);
124 newNode->filename[0] =
'\0';
126 newNode->line = _line;
127 newNode->size = _size;
128 newNode->data = newNode->DATA();
133void* AllocList::addTail(Node* _newNode)
137 NodeBase* masterNode = &__masterNode;
139 _newNode->next = masterNode;
140 _newNode->prev = masterNode->prev;
142 _newNode->prev->next = _newNode;
143 masterNode->prev = _newNode;
146 return _newNode->data;
149AllocList::Node* AllocList::reallocNode(
164 bool check_ = _node->check;
165 DCLAllocFunc func_ = _node->func;
167 Node* reNode = (Node*)realloc(_node, Node::SIZE() + _size);
169 if (reNode != _node) {
170 prev_->next = reNode;
171 next_->prev = reNode;
177 reNode->check = check_;
178 reNode->func = func_;
182 reNode->setFilename(_filename);
184 reNode->filename[0] = L
'\0';
186 reNode->line = _line;
187 reNode->size = _size;
188 reNode->data = reNode->DATA();
193AllocList::AllocList()
196 NodeBase* masterNode = &__masterNode;
197 masterNode->prev = masterNode;
198 masterNode->next = masterNode;
201AllocList::~AllocList()
207AllocList::Node* AllocList::begin()
const
209 const NodeBase* masterNode = &__masterNode;
210 if (masterNode->next == masterNode)
213 return (Node*)masterNode->next;
216AllocList::Node* AllocList::end()
const
218 const NodeBase* masterNode = &__masterNode;
219 if (masterNode->prev == masterNode)
222 return (Node*)masterNode->prev;
225AllocList::Node* AllocList::next(Node*& _node)
const
228 const NodeBase* masterNode = &__masterNode;
229 if (_node->next == masterNode)
232 _node = (Node*)_node->next;
237AllocList::Node* AllocList::prev(Node*& _node)
const
240 const NodeBase* masterNode = &__masterNode;
241 if (_node->prev == masterNode)
244 _node = (Node*)_node->prev;
249AllocList::Node* AllocList::find(
const void* _ptr)
const
251 const NodeBase* masterNode = &__masterNode;
252 const NodeBase* node = masterNode->next;
253 while(node != masterNode) {
254 if (((Node*)node)->data == _ptr)
262AllocList::Node* AllocList::rfind(
const void* _ptr)
const
264 const NodeBase* masterNode = &__masterNode;
265 const NodeBase* node = masterNode->prev;
266 while(node != masterNode) {
267 if (((Node*)node)->data == _ptr)
275void* AllocList::allocAddTail(
283 Node* newNode = allocNode(
291 return addTail(newNode);
296void AllocList::erase(Node* _node)
299 _node->prev->next = _node->next;
300 _node->next->prev = _node->prev;
306void AllocList::clear()
308 NodeBase* masterNode = &__masterNode;
311 while(node != masterNode) {
317 masterNode->next = masterNode;
318 masterNode->prev = masterNode;
343 while(node != masterNode) {
356 while(node != masterNode) {
357 if (((
Node*)node)->key == _key)
358 return ((
Node*)node)->value;
363 newNode->
prev = masterNode;
366 masterNode->
next = newNode;
369 return newNode->
value;
377 while(node != masterNode) {
378 if (((
Node*)node)->key == _key)
400 , lockGlobalOutput(
"LibState::lockGlobalOutput")
401 , mapThreadOutput(MAP_THREAD_OUTPUT_BUCKET_COUNT)
402 , lockThreadOutput(
"LibState::lockThreadOutput")
403#
if __DCL_HAVE_ALLOC_DEBUG
404 , lockAlloc(
"LibState::lockAlloc")
DCLCAPI size_t DCLGetNextPrimNumber(size_t _n)
DCLCAPI size_t DCLGetNextPrimNumber(size_t _n)
#define __DCL_ASSERT_N(expr)
#define __strncpy(d, s, n)
InternalMutex(const char *_name)
size_t bucketIndex(const void *_key) const
const void *& operator[](const void *_key)
Node * find(const void *_key) const
PtrHashMap(size_t _buckerCount)
DCLCleanupCallback pfnSQLCleanup
InternalMutex lockSQLDriverPool