summaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-30 02:05:40 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-01 03:11:26 +0300
commita39f63cdfa5ce15b22f294a8bb1db3a036ce462d (patch)
tree4de71bde947cae0cf5d3196cd97e82f5bc537c5c /src/debug
parent02ec4369acfbf261236631e20dbb76131e7889f8 (diff)
downloadmanaverse-a39f63cdfa5ce15b22f294a8bb1db3a036ce462d.tar.gz
manaverse-a39f63cdfa5ce15b22f294a8bb1db3a036ce462d.tar.bz2
manaverse-a39f63cdfa5ce15b22f294a8bb1db3a036ce462d.tar.xz
manaverse-a39f63cdfa5ce15b22f294a8bb1db3a036ce462d.zip
One part of fixes after auto checking.
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/debug_new.cpp18
-rw-r--r--src/debug/fast_mutex.h2
2 files changed, 10 insertions, 10 deletions
diff --git a/src/debug/debug_new.cpp b/src/debug/debug_new.cpp
index fb83cab4a..30834feed 100644
--- a/src/debug/debug_new.cpp
+++ b/src/debug/debug_new.cpp
@@ -131,7 +131,7 @@
* Windows command prompt.
*/
#ifndef M_DEBUG_NEW_PROGNAME
-#define M_DEBUG_NEW_PROGNAME NULL
+#define M_DEBUG_NEW_PROGNAME nullptr
#endif
/**
@@ -311,7 +311,7 @@ const char* new_progname = M_DEBUG_NEW_PROGNAME;
*/
static bool print_position_from_addr(const void* addr)
{
- static const void* last_addr = NULL;
+ static const void* last_addr = nullptr;
static char last_info[256] = "";
if (addr == last_addr)
{
@@ -416,7 +416,7 @@ static void print_position(const void* ptr, int line)
{
fprintf(new_output_fp, "%s:%d", (const char*)ptr, line);
}
- else if (ptr != NULL) // Is caller address present?
+ else if (ptr != nullptr) // Is caller address present?
{
if (!print_position_from_addr(ptr)) // Fail to get source position?
fprintf(new_output_fp, "%p", ptr);
@@ -467,10 +467,10 @@ static void* alloc_mem(size_t size, const char* file, int line, bool is_array)
STATIC_ASSERT(M_DEBUG_NEW_TAILCHECK >= 0, Invalid_tail_check_length);
size_t s = size + ALIGNED_LIST_ITEM_SIZE + M_DEBUG_NEW_TAILCHECK;
new_ptr_list_t* ptr = (new_ptr_list_t*)malloc(s);
- if (ptr == NULL)
+ if (ptr == nullptr)
{
#if M_DEBUG_NEW_STD_OPER_NEW
- return NULL;
+ return nullptr;
#else
fast_mutex_autolock lock(new_output_lock);
fprintf(new_output_fp,
@@ -537,7 +537,7 @@ static void* alloc_mem(size_t size, const char* file, int line, bool is_array)
*/
static void free_pointer(void* pointer, void* addr, bool is_array)
{
- if (pointer == NULL)
+ if (pointer == nullptr)
return;
new_ptr_list_t* ptr =
(new_ptr_list_t*)((char*)pointer - ALIGNED_LIST_ITEM_SIZE);
@@ -726,7 +726,7 @@ int check_mem_corruption()
void __debug_new_recorder::_M_process(void* pointer)
{
- if (pointer == NULL)
+ if (pointer == nullptr)
return;
new_ptr_list_t* ptr =
(new_ptr_list_t*)((char*)pointer - ALIGNED_LIST_ITEM_SIZE);
@@ -773,12 +773,12 @@ void* operator new [](size_t size, const char* file, int line)
#endif
}
-void* operator new (size_t size) throw(std::bad_alloc)
+void* operator new (size_t size) //throw(std::bad_alloc)
{
return operator new (size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0);
}
-void* operator new [](size_t size) throw(std::bad_alloc)
+void* operator new [](size_t size) //throw(std::bad_alloc)
{
return operator new [](size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0);
}
diff --git a/src/debug/fast_mutex.h b/src/debug/fast_mutex.h
index 60ad1f305..1380c683b 100644
--- a/src/debug/fast_mutex.h
+++ b/src/debug/fast_mutex.h
@@ -130,7 +130,7 @@
: _M_locked(false)
# endif
{
- ::pthread_mutex_init(&_M_mtx_impl, NULL);
+ ::pthread_mutex_init(&_M_mtx_impl, nullptr);
# if _FAST_MUTEX_CHECK_INITIALIZATION
_M_initialized = true;
# endif