From: khizmax Date: Sat, 20 Sep 2014 14:00:52 +0000 (+0400) Subject: Replace NULL with nullptr X-Git-Tag: v2.0.0~327 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=commitdiff_plain;h=2e8a58841ca3d7cc736cc9483b691cf70c3ecdb3 Replace NULL with nullptr --- diff --git a/.gitignore b/.gitignore index ac4f212f..80814439 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,9 @@ /tools/doxygen.log /doc +/projects/Win/vc12/cds.opensdf +/projects/Win/vc12/cds.sdf +/projects/Win/vc12/cds.v12.suo +/tests/cppunit/*.o +*.o +/todo-2.0.txt +/tests/data/dictionary.txt diff --git a/cds/algo/backoff_strategy.h b/cds/algo/backoff_strategy.h index a4f99072..01c1dbd1 100644 --- a/cds/algo/backoff_strategy.h +++ b/cds/algo/backoff_strategy.h @@ -342,7 +342,7 @@ namespace cds { \endcode */ - template + template class delay { public: @@ -400,7 +400,7 @@ namespace cds { The declaration cds::backoff::delay_of< 5 > bkoff is equal for cds::backoff::delay<> bkoff(5). */ - template + template class delay_of: public delay { //@cond diff --git a/cds/compiler/cxx11_atomic.h b/cds/compiler/cxx11_atomic.h index 1adbb3e8..96ab4399 100644 --- a/cds/compiler/cxx11_atomic.h +++ b/cds/compiler/cxx11_atomic.h @@ -253,12 +253,12 @@ namespace cds { namespace cxx11_atomics { // cas static bool atomic_compare_exchange_weak_explicit( T volatile * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas8_weak( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_weak_explicit( T * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas8_weak( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_weak( T volatile * pDest, T * expected, T desired ) CDS_NOEXCEPT @@ -271,12 +271,12 @@ namespace cds { namespace cxx11_atomics { } static bool atomic_compare_exchange_strong_explicit( T volatile * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas8_strong( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_strong_explicit( T * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas8_strong( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_strong( T volatile * pDest, T * expected, T desired ) CDS_NOEXCEPT @@ -475,12 +475,12 @@ namespace cds { namespace cxx11_atomics { // cas static bool atomic_compare_exchange_weak_explicit( T volatile * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas16_weak( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_weak_explicit( T * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas16_weak( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_weak( T volatile * pDest, T * expected, T desired ) CDS_NOEXCEPT @@ -493,12 +493,12 @@ namespace cds { namespace cxx11_atomics { } static bool atomic_compare_exchange_strong_explicit( T volatile * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas16_strong( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_strong_explicit( T * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas16_strong( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_strong( T volatile * pDest, T * expected, T desired ) CDS_NOEXCEPT @@ -697,12 +697,12 @@ namespace cds { namespace cxx11_atomics { // cas static bool atomic_compare_exchange_weak_explicit( T volatile * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas32_weak( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_weak_explicit( T * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas32_weak( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_weak( T volatile * pDest, T * expected, T desired ) CDS_NOEXCEPT @@ -715,12 +715,12 @@ namespace cds { namespace cxx11_atomics { } static bool atomic_compare_exchange_strong_explicit( T volatile * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas32_strong( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_strong_explicit( T * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas32_strong( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_strong( T volatile * pDest, T * expected, T desired ) CDS_NOEXCEPT @@ -919,12 +919,12 @@ namespace cds { namespace cxx11_atomics { // cas static bool atomic_compare_exchange_weak_explicit( T volatile * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas64_weak( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_weak_explicit( T * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas64_weak( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_weak( T volatile * pDest, T * expected, T desired ) CDS_NOEXCEPT @@ -937,12 +937,12 @@ namespace cds { namespace cxx11_atomics { } static bool atomic_compare_exchange_strong_explicit( T volatile * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas64_strong( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_strong_explicit( T * pDest, T * expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas64_strong( primary::ptr(pDest), primary::ref(*expected), primary::val(desired), mo_success, mo_fail ); } static bool atomic_compare_exchange_strong( T volatile * pDest, T * expected, T desired ) CDS_NOEXCEPT @@ -1141,12 +1141,12 @@ namespace cds { namespace cxx11_atomics { // cas static bool atomic_compare_exchange_weak_explicit( T * volatile * pDest, T * * expected, T * desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas_ptr_weak( pDest, *expected, desired, mo_success, mo_fail ); } static bool atomic_compare_exchange_weak_explicit( T * * pDest, T * * expected, T * desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas_ptr_weak( pDest, *expected, desired, mo_success, mo_fail ); } static bool atomic_compare_exchange_weak( T * volatile * pDest, T ** expected, T * desired ) CDS_NOEXCEPT @@ -1159,12 +1159,12 @@ namespace cds { namespace cxx11_atomics { } static bool atomic_compare_exchange_strong_explicit( T * volatile * pDest, T ** expected, T * desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas_ptr_strong( pDest, *expected, desired, mo_success, mo_fail ); } static bool atomic_compare_exchange_strong_explicit( T ** pDest, T ** expected, T * desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { - assert( expected != NULL ); + assert( expected ); return platform::cas_ptr_strong( pDest, *expected, desired, mo_success, mo_fail ); } static bool atomic_compare_exchange_strong( T * volatile * pDest, T ** expected, T * desired ) CDS_NOEXCEPT diff --git a/cds/compiler/gcc/amd64/cxx11_atomic.h b/cds/compiler/gcc/amd64/cxx11_atomic.h index afb9a749..b79befcc 100644 --- a/cds/compiler/gcc/amd64/cxx11_atomic.h +++ b/cds/compiler/gcc/amd64/cxx11_atomic.h @@ -55,7 +55,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); assert( cds::details::is_aligned( pSrc, 8 )); T v = *pSrc; @@ -87,7 +87,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); assert( cds::details::is_aligned( pDest, 8 )); if (order != memory_order_seq_cst) { @@ -153,7 +153,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); if ( order != memory_order_seq_cst ) { fence_before( order ); @@ -173,7 +173,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); T * v = *pSrc; fence_after_load( order ); diff --git a/cds/compiler/gcc/ia64/cxx11_atomic.h b/cds/compiler/gcc/ia64/cxx11_atomic.h index cacfa9d1..12582c2d 100644 --- a/cds/compiler/gcc/ia64/cxx11_atomic.h +++ b/cds/compiler/gcc/ia64/cxx11_atomic.h @@ -105,7 +105,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire \ || order == memory_order_seq_cst \ ) ; \ - assert( pSrc != NULL ) ; \ + assert( pSrc ) ; \ T val ; \ __asm__ __volatile__ ( \ "ld" #n_bytes ".acq %[val] = [%[pSrc]] \n\t" \ @@ -125,7 +125,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release \ || order == memory_order_seq_cst \ ) ; \ - assert( pDest != NULL ) ; \ + assert( pDest ) ; \ if ( order == memory_order_seq_cst ) { \ __asm__ __volatile__ ( \ "st" #n_bytes ".rel [%[pDest]] = %[val] \n\t" \ @@ -199,7 +199,7 @@ namespace cds { namespace cxx11_atomics { static inline T exchange##n_bits( T volatile * pDest, T val, memory_order order ) CDS_NOEXCEPT \ { \ static_assert( sizeof(T) == n_bytes, "Illegal size of operand" ) ; \ - assert( pDest != NULL ) ; \ + assert( pDest ) ; \ T current ; \ switch(order) \ { \ @@ -295,7 +295,7 @@ namespace cds { namespace cxx11_atomics { static inline T fetch32_add( T volatile * pDest, T val, memory_order order) CDS_NOEXCEPT { static_assert( sizeof(T) == 4, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T cur; switch ( val ) { @@ -324,7 +324,7 @@ namespace cds { namespace cxx11_atomics { static inline T fetch32_sub( T volatile * pDest, T val, memory_order order) CDS_NOEXCEPT { static_assert( sizeof(T) == 4, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T cur; switch ( val ) { case 1: @@ -361,7 +361,7 @@ namespace cds { namespace cxx11_atomics { static inline T fetch64_add( T volatile * pDest, T val, memory_order order) CDS_NOEXCEPT { static_assert( sizeof(T) == 8, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T cur; switch ( val ) { @@ -390,7 +390,7 @@ namespace cds { namespace cxx11_atomics { static inline T fetch64_sub( T volatile * pDest, T val, memory_order order) CDS_NOEXCEPT { static_assert( sizeof(T) == 8, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T cur; switch ( val ) { case 1: @@ -424,7 +424,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); T * val; __asm__ __volatile__ ( "ld8.acq %[val] = [%[pSrc]] \n\t" @@ -442,7 +442,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); if ( order == memory_order_seq_cst ) { __asm__ __volatile__ ( @@ -466,7 +466,7 @@ namespace cds { namespace cxx11_atomics { static inline bool cas_ptr_strong( T * volatile * pDest, T *& expected, T * desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { static_assert( sizeof(T *) == 8, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T * current; @@ -523,7 +523,7 @@ namespace cds { namespace cxx11_atomics { static inline T * exchange_ptr( T * volatile * pDest, T * val, memory_order order ) CDS_NOEXCEPT { static_assert( sizeof(T *) == 8, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T * current; switch(order) { @@ -558,13 +558,13 @@ namespace cds { namespace cxx11_atomics { template <> struct atomic_pointer_sizeof { enum { value = 1 }; }; // It does not work properly - // atomic.fetch_add( ... ) returns NULL, why?.. + // atomic.fetch_add( ... ) returns nullptr, why?.. //# define CDS_ATOMIC_fetch_ptr_add_defined template static inline T * fetch_ptr_add( T * volatile * pDest, ptrdiff_t val, memory_order order) CDS_NOEXCEPT { static_assert( sizeof(T *) == 8, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T * cur; val *= atomic_pointer_sizeof::value; @@ -590,13 +590,13 @@ namespace cds { namespace cxx11_atomics { } // It does not work properly - // atomic.fetch_sub( ... ) returns NULL, why?.. + // atomic.fetch_sub( ... ) returns nullptr, why?.. //# define CDS_ATOMIC_fetch_ptr_sub_defined template static inline T * fetch_ptr_sub( T * volatile * pDest, ptrdiff_t val, memory_order order) CDS_NOEXCEPT { static_assert( sizeof(T *) == 8, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T * cur; val *= atomic_pointer_sizeof::value; switch ( val ) { diff --git a/cds/compiler/gcc/sparc/cxx11_atomic.h b/cds/compiler/gcc/sparc/cxx11_atomic.h index 801bc796..f160e909 100644 --- a/cds/compiler/gcc/sparc/cxx11_atomic.h +++ b/cds/compiler/gcc/sparc/cxx11_atomic.h @@ -165,7 +165,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); fence_before(order); *pDest = src; @@ -181,7 +181,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); fence_before(order); T v = *pSrc; @@ -193,7 +193,7 @@ namespace cds { namespace cxx11_atomics { static inline bool cas32_strong( T volatile * pDest, T& expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { static_assert( sizeof(T) == 4, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); fence_before( mo_success ); __asm__ __volatile__( @@ -226,7 +226,7 @@ namespace cds { namespace cxx11_atomics { static inline T exchange32( T volatile * pDest, T v, memory_order order ) CDS_NOEXCEPT { static_assert( sizeof(T) == 4, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); // This primitive could be implemented via "swap" instruction but "swap" is deprecated in UltraSparc @@ -248,7 +248,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); fence_before(order); T v = *pSrc; @@ -264,7 +264,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); fence_before(order); *pDest = val; @@ -276,7 +276,7 @@ namespace cds { namespace cxx11_atomics { static inline bool cas64_strong( T volatile * pDest, T& expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { static_assert( sizeof(T) == 8, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); fence_before( mo_success ); __asm__ __volatile__( @@ -310,7 +310,7 @@ namespace cds { namespace cxx11_atomics { static inline T exchange64( T volatile * pDest, T v, memory_order order ) CDS_NOEXCEPT { static_assert( sizeof(T) == 8, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T cur = load64( pDest, memory_order_relaxed ); do {} while ( !cas64_strong( pDest, cur, v, order, memory_order_relaxed )); @@ -329,7 +329,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); fence_before( order ); *pDest = src; @@ -345,7 +345,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); fence_before( order ); T v = *pSrc; @@ -357,7 +357,7 @@ namespace cds { namespace cxx11_atomics { static inline bool cas8_strong( T volatile * pDest, T& expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { static_assert( sizeof(T) == 1, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); union u32 { uint32_t w; @@ -390,7 +390,7 @@ namespace cds { namespace cxx11_atomics { static inline bool cas8_weak( T volatile * pDest, T& expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { static_assert( sizeof(T) == 1, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); union u32 { uint32_t w; @@ -418,7 +418,7 @@ namespace cds { namespace cxx11_atomics { static inline T exchange8( T volatile * pDest, T v, memory_order order ) CDS_NOEXCEPT { static_assert( sizeof(T) == 1, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T cur = load8( pDest, memory_order_relaxed ); do {} while ( !cas8_strong( pDest, cur, v, order, memory_order_relaxed )); @@ -438,7 +438,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); fence_before( order ); T v = *pSrc; @@ -454,7 +454,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); fence_before(order); *pDest = src; @@ -465,7 +465,7 @@ namespace cds { namespace cxx11_atomics { static inline bool cas16_strong( T volatile * pDest, T& expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { static_assert( sizeof(T) == 2, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); union u32 { uint32_t w; @@ -498,7 +498,7 @@ namespace cds { namespace cxx11_atomics { static inline bool cas16_weak( T volatile * pDest, T& expected, T desired, memory_order mo_success, memory_order mo_fail ) CDS_NOEXCEPT { static_assert( sizeof(T) == 2, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); union u32 { uint32_t w; @@ -526,7 +526,7 @@ namespace cds { namespace cxx11_atomics { static inline T exchange16( T volatile * pDest, T v, memory_order order ) CDS_NOEXCEPT { static_assert( sizeof(T) == 2, "Illegal size of operand" ); - assert( pDest != NULL ); + assert( pDest ); T cur = load16( pDest, memory_order_relaxed ); do {} while ( !cas16_strong( pDest, cur, v, order, memory_order_relaxed )); @@ -545,7 +545,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); fence_before(order); *pDest = src; @@ -561,7 +561,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); fence_before( order ); T * v = *pSrc; diff --git a/cds/compiler/gcc/x86/cxx11_atomic.h b/cds/compiler/gcc/x86/cxx11_atomic.h index 152ccc7c..52fc7398 100644 --- a/cds/compiler/gcc/x86/cxx11_atomic.h +++ b/cds/compiler/gcc/x86/cxx11_atomic.h @@ -59,7 +59,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); assert( cds::details::is_aligned( pSrc, 8 )); T CDS_DATA_ALIGNMENT(8) v; @@ -93,7 +93,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); assert( cds::details::is_aligned( pDest, 8 )); if ( order != memory_order_seq_cst ) { @@ -132,7 +132,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); if ( order != memory_order_seq_cst ) { fence_before( order ); @@ -152,7 +152,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); T * v = *pSrc; fence_after_load( order ); diff --git a/cds/compiler/vc/amd64/cxx11_atomic.h b/cds/compiler/vc/amd64/cxx11_atomic.h index 49b2f2c3..29d8b859 100644 --- a/cds/compiler/vc/amd64/cxx11_atomic.h +++ b/cds/compiler/vc/amd64/cxx11_atomic.h @@ -242,7 +242,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); if ( order != memory_order_seq_cst ) { fence_before( order ); @@ -262,7 +262,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); T v = *pSrc; fence_after_load( order ); @@ -315,7 +315,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); assert( cds::details::is_aligned( pDest, 2 )); if ( order != memory_order_seq_cst ) { @@ -336,7 +336,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); assert( cds::details::is_aligned( pSrc, 2 )); T v = *pSrc; @@ -365,7 +365,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); assert( cds::details::is_aligned( pDest, 4 )); if ( order != memory_order_seq_cst ) { @@ -386,7 +386,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); assert( cds::details::is_aligned( pSrc, 4 )); T v = *pSrc; @@ -458,7 +458,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); assert( cds::details::is_aligned( pSrc, 8 )); T v = *pSrc; @@ -486,7 +486,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); assert( cds::details::is_aligned( pDest, 8 )); if ( order != memory_order_seq_cst ) { @@ -528,7 +528,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); if ( order != memory_order_seq_cst ) { fence_before( order ); @@ -548,7 +548,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); T * v = *pSrc; fence_after_load( order ); diff --git a/cds/compiler/vc/x86/cxx11_atomic.h b/cds/compiler/vc/x86/cxx11_atomic.h index 4670a3b1..b11d50f7 100644 --- a/cds/compiler/vc/x86/cxx11_atomic.h +++ b/cds/compiler/vc/x86/cxx11_atomic.h @@ -220,7 +220,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); if ( order != memory_order_seq_cst ) { fence_before( order ); @@ -240,7 +240,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); T v = *pSrc; fence_after_load( order ); @@ -276,7 +276,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); assert( cds::details::is_aligned( pDest, 2 )); if ( order != memory_order_seq_cst ) { @@ -297,7 +297,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); assert( cds::details::is_aligned( pSrc, 2 )); T v = *pSrc; @@ -344,7 +344,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); assert( cds::details::is_aligned( pDest, 4 )); if ( order != memory_order_seq_cst ) { @@ -365,7 +365,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); assert( cds::details::is_aligned( pSrc, 4 )); T v( *pSrc ); @@ -437,7 +437,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); assert( cds::details::is_aligned( pSrc, 8 )); // Atomically loads 64bit value by SSE intrinsics @@ -466,7 +466,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); assert( cds::details::is_aligned( pDest, 8 )); if ( order != memory_order_seq_cst ) { @@ -501,7 +501,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_release || order == memory_order_seq_cst ); - assert( pDest != NULL ); + assert( pDest ); if ( order != memory_order_seq_cst ) { fence_before( order ); @@ -521,7 +521,7 @@ namespace cds { namespace cxx11_atomics { || order == memory_order_acquire || order == memory_order_seq_cst ); - assert( pSrc != NULL ); + assert( pSrc ); T * v = *pSrc; fence_after_load( order ); diff --git a/cds/container/basket_queue.h b/cds/container/basket_queue.h index b0425e0a..4bed4452 100644 --- a/cds/container/basket_queue.h +++ b/cds/container/basket_queue.h @@ -381,7 +381,7 @@ namespace cds { namespace container { /// Clear the queue /** - The function repeatedly calls \ref dequeue until it returns NULL. + The function repeatedly calls \ref dequeue until it returns \p nullptr. */ void clear() { diff --git a/cds/container/cuckoo_map.h b/cds/container/cuckoo_map.h index d9282266..45c4b976 100644 --- a/cds/container/cuckoo_map.h +++ b/cds/container/cuckoo_map.h @@ -138,9 +138,9 @@ namespace cds { namespace container { The insert(x) successively "kicks out" conflicting items until every key has a slot. To add \p x, the method swaps \p x with \p y, the current occupant of table[0][h0(x)]. - If the prior value was \p NULL, it is done. Otherwise, it swaps the newly nest-less value \p y + If the prior value was \p nullptr, it is done. Otherwise, it swaps the newly nest-less value \p y for the current occupant of table[1][h1(y)] in the same way. As before, if the prior value - was \p NULL, it is done. Otherwise, the method continues swapping entries (alternating tables) + was \p nullptr, it is done. Otherwise, the method continues swapping entries (alternating tables) until it finds an empty slot. We might not find an empty slot, either because the table is full, or because the sequence of displacement forms a cycle. We therefore need an upper limit on the number of successive displacements we are willing to undertake. When this limit is exceeded, diff --git a/cds/container/cuckoo_set.h b/cds/container/cuckoo_set.h index 05606af2..14f77297 100644 --- a/cds/container/cuckoo_set.h +++ b/cds/container/cuckoo_set.h @@ -111,9 +111,9 @@ namespace cds { namespace container { The insert(x) successively "kicks out" conflicting items until every key has a slot. To add \p x, the method swaps \p x with \p y, the current occupant of table[0][h0(x)]. - If the prior value was \p NULL, it is done. Otherwise, it swaps the newly nest-less value \p y + If the prior value was \p nullptr, it is done. Otherwise, it swaps the newly nest-less value \p y for the current occupant of table[1][h1(y)] in the same way. As before, if the prior value - was \p NULL, it is done. Otherwise, the method continues swapping entries (alternating tables) + was \p nullptr, it is done. Otherwise, the method continues swapping entries (alternating tables) until it finds an empty slot. We might not find an empty slot, either because the table is full, or because the sequence of displacement forms a cycle. We therefore need an upper limit on the number of successive displacements we are willing to undertake. When this limit is exceeded, diff --git a/cds/container/ellen_bintree_map_rcu.h b/cds/container/ellen_bintree_map_rcu.h index 42aa769d..1f968d3c 100644 --- a/cds/container/ellen_bintree_map_rcu.h +++ b/cds/container/ellen_bintree_map_rcu.h @@ -633,7 +633,7 @@ namespace cds { namespace container { /// Finds \p key and return the item found /** \anchor cds_nonintrusive_EllenBinTreeMap_rcu_get The function searches the item with key equal to \p key and returns the pointer to item found. - If \p key is not found it returns \p NULL. + If \p key is not found it returns \p nullptr. RCU should be locked before call the function. Returned pointer is valid while RCU is locked. diff --git a/cds/container/ellen_bintree_set_rcu.h b/cds/container/ellen_bintree_set_rcu.h index e606ec3b..11ea6f52 100644 --- a/cds/container/ellen_bintree_set_rcu.h +++ b/cds/container/ellen_bintree_set_rcu.h @@ -694,7 +694,7 @@ namespace cds { namespace container { /// Finds \p key and return the item found /** \anchor cds_nonintrusive_EllenBinTreeSet_rcu_get The function searches the item with key equal to \p key and returns the pointer to item found. - If \p key is not found it returns \p NULL. + If \p key is not found it returns \p nullptr. RCU should be locked before call the function. Returned pointer is valid while RCU is locked. diff --git a/cds/container/lazy_kvlist_impl.h b/cds/container/lazy_kvlist_impl.h index 97a53e54..66179fe0 100644 --- a/cds/container/lazy_kvlist_impl.h +++ b/cds/container/lazy_kvlist_impl.h @@ -380,7 +380,7 @@ namespace cds { namespace container { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to NULL. + Internally, end returning value equals to \p nullptr. The returned value can be used only to control reaching the end of the list. For empty list \code begin() == end() \endcode diff --git a/cds/container/lazy_kvlist_nogc.h b/cds/container/lazy_kvlist_nogc.h index 0d7017da..d2d36e97 100644 --- a/cds/container/lazy_kvlist_nogc.h +++ b/cds/container/lazy_kvlist_nogc.h @@ -307,7 +307,7 @@ namespace cds { namespace container { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to NULL. + Internally, end returning value equals to nullptr. The returned value can be used only to control reaching the end of the list. For empty list \code begin() == end() \endcode diff --git a/cds/container/lazy_kvlist_rcu.h b/cds/container/lazy_kvlist_rcu.h index 266cb5c1..20d2f475 100644 --- a/cds/container/lazy_kvlist_rcu.h +++ b/cds/container/lazy_kvlist_rcu.h @@ -744,7 +744,7 @@ namespace cds { namespace container { /// Finds \p key and return the item found /** \anchor cds_nonintrusive_LazyKVList_rcu_get The function searches the item with \p key and returns the pointer to item found. - If \p key is not found it returns \p NULL. + If \p key is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p K that can be not the same as \p key_type. diff --git a/cds/container/lazy_list_rcu.h b/cds/container/lazy_list_rcu.h index 77dfe416..e9bc4dfe 100644 --- a/cds/container/lazy_list_rcu.h +++ b/cds/container/lazy_list_rcu.h @@ -777,7 +777,7 @@ namespace cds { namespace container { /// Finds the key \p val and return the item found /** \anchor cds_nonintrusive_LazyList_rcu_get The function searches the item with key equal to \p val and returns the pointer to item found. - If \p val is not found it returns \p NULL. + If \p val is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/container/michael_deque.h b/cds/container/michael_deque.h index 7cac6462..bef5df18 100644 --- a/cds/container/michael_deque.h +++ b/cds/container/michael_deque.h @@ -473,7 +473,7 @@ namespace cds { namespace container { /// Clear the deque /** - The function repeatedly calls \ref pop_back until it returns \p NULL. + The function repeatedly calls \ref pop_back until it returns \p nullptr. */ void clear() { diff --git a/cds/container/michael_kvlist_impl.h b/cds/container/michael_kvlist_impl.h index 9aa13cfc..92e31592 100644 --- a/cds/container/michael_kvlist_impl.h +++ b/cds/container/michael_kvlist_impl.h @@ -364,7 +364,7 @@ namespace cds { namespace container { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to NULL. + Internally, end returning value equals to \p nullptr. The returned value can be used only to control reaching the end of the list. For empty list \code begin() == end() \endcode diff --git a/cds/container/michael_kvlist_nogc.h b/cds/container/michael_kvlist_nogc.h index 01c2da07..a9575b29 100644 --- a/cds/container/michael_kvlist_nogc.h +++ b/cds/container/michael_kvlist_nogc.h @@ -296,7 +296,7 @@ namespace cds { namespace container { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to NULL. + Internally, end returning value equals to \p nullptr. The returned value can be used only to control reaching the end of the list. For empty list \code begin() == end() \endcode diff --git a/cds/container/michael_kvlist_rcu.h b/cds/container/michael_kvlist_rcu.h index 06b69e63..e606c568 100644 --- a/cds/container/michael_kvlist_rcu.h +++ b/cds/container/michael_kvlist_rcu.h @@ -352,7 +352,7 @@ namespace cds { namespace container { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to NULL. + Internally, end returning value equals to \p nullptr. The returned value can be used only to control reaching the end of the list. For empty list \code begin() == end() \endcode @@ -728,7 +728,7 @@ namespace cds { namespace container { /// Finds \p key and return the item found /** \anchor cds_nonintrusive_MichaelKVList_rcu_get The function searches the item with \p key and returns the pointer to item found. - If \p key is not found it returns \p NULL. + If \p key is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p K that can be not the same as \p key_type. diff --git a/cds/container/michael_list_impl.h b/cds/container/michael_list_impl.h index ccec178a..de789738 100644 --- a/cds/container/michael_list_impl.h +++ b/cds/container/michael_list_impl.h @@ -278,7 +278,7 @@ namespace cds { namespace container { value_ptr operator ->() const { typename iterator_base::value_ptr p = iterator_base::operator ->(); - return p ? &(p->m_Value) : reinterpret_cast(NULL); + return p ? &(p->m_Value) : nullptr; } value_ref operator *() const @@ -341,7 +341,7 @@ namespace cds { namespace container { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to NULL. + Internally, end returning value equals to \p nullptr. The returned value can be used only to control reaching the end of the list. For empty list \code begin() == end() \endcode @@ -798,7 +798,7 @@ namespace cds { namespace container { //@cond bool insert_node_at( head_type& refHead, node_type * pNode ) { - assert( pNode != NULL ); + assert( pNode ); scoped_node_ptr p(pNode); if ( base_class::insert_at( refHead, *pNode )) { p.release(); diff --git a/cds/container/michael_list_nogc.h b/cds/container/michael_list_nogc.h index e18a10da..41a023b0 100644 --- a/cds/container/michael_list_nogc.h +++ b/cds/container/michael_list_nogc.h @@ -83,7 +83,7 @@ namespace cds { namespace container { node_type * m_pItemFound; ensure_functor() - : m_pItemFound( NULL ) + : m_pItemFound( nullptr ) {} void operator ()(bool, node_type& item, node_type& ) @@ -174,7 +174,7 @@ namespace cds { namespace container { value_ptr operator ->() const { typename iterator_base::value_ptr p = iterator_base::operator ->(); - return p ? &(p->m_Value) : reinterpret_cast(NULL); + return p ? &(p->m_Value) : nullptr; } value_ref operator *() const @@ -233,7 +233,7 @@ namespace cds { namespace container { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to NULL. + Internally, end returning value equals to \p nullptr. The returned value can be used only to control reaching the end of the list. For empty list \code begin() == end() \endcode diff --git a/cds/container/michael_list_rcu.h b/cds/container/michael_list_rcu.h index 9a46b000..2ee4d7dc 100644 --- a/cds/container/michael_list_rcu.h +++ b/cds/container/michael_list_rcu.h @@ -290,7 +290,7 @@ namespace cds { namespace container { value_ptr operator ->() const { typename iterator_base::value_ptr p = iterator_base::operator ->(); - return p ? &(p->m_Value) : reinterpret_cast(NULL); + return p ? &(p->m_Value) : nullptr; } value_ref operator *() const @@ -337,7 +337,7 @@ namespace cds { namespace container { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to NULL. + Internally, end returning value equals to \p nullptr. The returned value can be used only to control reaching the end of the list. For empty list \code begin() == end() \endcode @@ -748,7 +748,7 @@ namespace cds { namespace container { /// Finds the key \p val and return the item found /** \anchor cds_nonintrusive_MichaelList_rcu_get The function searches the item with key equal to \p val and returns the pointer to item found. - If \p val is not found it returns \p NULL. + If \p val is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p Q that can be not the same as \p value_type. @@ -825,7 +825,7 @@ namespace cds { namespace container { //@cond bool insert_node_at( head_type& refHead, node_type * pNode ) { - assert( pNode != NULL ); + assert( pNode ); scoped_node_ptr p(pNode); if ( base_class::insert_at( refHead, *pNode )) { p.release(); diff --git a/cds/container/michael_map.h b/cds/container/michael_map.h index 102aaf31..762267d3 100644 --- a/cds/container/michael_map.h +++ b/cds/container/michael_map.h @@ -89,7 +89,7 @@ namespace cds { namespace container { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. \anchor cds_nonintrusive_MichaelHashMap_how_touse How to use diff --git a/cds/container/michael_map_rcu.h b/cds/container/michael_map_rcu.h index 9e829e65..d3e0510c 100644 --- a/cds/container/michael_map_rcu.h +++ b/cds/container/michael_map_rcu.h @@ -686,7 +686,7 @@ namespace cds { namespace container { /// Finds \p key and return the item found /** \anchor cds_nonintrusive_MichaelHashMap_rcu_get The function searches the item with key equal to \p key and returns the pointer to item found. - If \p key is not found it returns \p NULL. + If \p key is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p K that can be not the same as \p key_type. diff --git a/cds/container/michael_set.h b/cds/container/michael_set.h index 9bdcfaef..2b1ebbf6 100644 --- a/cds/container/michael_set.h +++ b/cds/container/michael_set.h @@ -110,7 +110,7 @@ namespace cds { namespace container { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. How to use diff --git a/cds/container/michael_set_rcu.h b/cds/container/michael_set_rcu.h index 67d4effe..152fbf9b 100644 --- a/cds/container/michael_set_rcu.h +++ b/cds/container/michael_set_rcu.h @@ -658,7 +658,7 @@ namespace cds { namespace container { /// Finds the key \p val and return the item found /** \anchor cds_nonintrusive_MichaelHashSet_rcu_get The function searches the item with key equal to \p val and returns the pointer to item found. - If \p val is not found it returns \p NULL. + If \p val is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/container/moir_queue.h b/cds/container/moir_queue.h index 5f881eac..be75ba3e 100644 --- a/cds/container/moir_queue.h +++ b/cds/container/moir_queue.h @@ -322,7 +322,7 @@ namespace cds { namespace container { /// Clear the queue /** - The function repeatedly calls \ref dequeue until it returns NULL. + The function repeatedly calls \ref dequeue until it returns nullptr. The disposer defined in template \p Options is called for each item that can be safely disposed. */ diff --git a/cds/container/msqueue.h b/cds/container/msqueue.h index a6ecd6c2..37f605ae 100644 --- a/cds/container/msqueue.h +++ b/cds/container/msqueue.h @@ -332,7 +332,7 @@ namespace cds { namespace container { /// Clear the queue /** - The function repeatedly calls \ref dequeue until it returns NULL. + The function repeatedly calls \ref dequeue until it returns \p nullptr. */ void clear() { diff --git a/cds/container/optimistic_queue.h b/cds/container/optimistic_queue.h index f9faeade..93121376 100644 --- a/cds/container/optimistic_queue.h +++ b/cds/container/optimistic_queue.h @@ -341,7 +341,7 @@ namespace cds { namespace container { /// Clear the queue /** - The function repeatedly calls \ref dequeue until it returns NULL. + The function repeatedly calls \ref dequeue until it returns \p nullptr. */ void clear() { diff --git a/cds/container/skip_list_map_impl.h b/cds/container/skip_list_map_impl.h index a1c83eda..0f9ccea6 100644 --- a/cds/container/skip_list_map_impl.h +++ b/cds/container/skip_list_map_impl.h @@ -108,7 +108,7 @@ namespace cds { namespace container { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \ cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \ cend member functions points to \p nullptr and should not be dereferenced. */ template < diff --git a/cds/container/skip_list_map_nogc.h b/cds/container/skip_list_map_nogc.h index cb402ebe..2ab08886 100644 --- a/cds/container/skip_list_map_nogc.h +++ b/cds/container/skip_list_map_nogc.h @@ -323,7 +323,7 @@ namespace cds { namespace container { /// Gets minimum key from the map /** - If the map is empty the function returns \p NULL + If the map is empty the function returns \p nullptr */ value_type * get_min() const { @@ -332,7 +332,7 @@ namespace cds { namespace container { /// Gets maximum key from the map /** - The function returns \p NULL if the map is empty + The function returns \p nullptr if the map is empty */ value_type * get_max() const { diff --git a/cds/container/skip_list_map_rcu.h b/cds/container/skip_list_map_rcu.h index 68336c77..42b6d62f 100644 --- a/cds/container/skip_list_map_rcu.h +++ b/cds/container/skip_list_map_rcu.h @@ -97,7 +97,7 @@ namespace cds { namespace container { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. */ template < @@ -718,7 +718,7 @@ namespace cds { namespace container { /// Finds the key \p key and return the item found /** \anchor cds_nonintrusive_SkipListMap_rcu_get The function searches the item with key equal to \p key and returns the pointer to item found. - If \p key is not found it returns \p NULL. + If \p key is not found it returns \p nullptr. Note the compare functor in \p Traits class' template argument should accept a parameter of type \p K that can be not the same as \p key_type. diff --git a/cds/container/skip_list_set_impl.h b/cds/container/skip_list_set_impl.h index 70abe853..1a38e989 100644 --- a/cds/container/skip_list_set_impl.h +++ b/cds/container/skip_list_set_impl.h @@ -105,7 +105,7 @@ namespace cds { namespace container { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. */ template < diff --git a/cds/container/skip_list_set_nogc.h b/cds/container/skip_list_set_nogc.h index 4c669577..17d22fbc 100644 --- a/cds/container/skip_list_set_nogc.h +++ b/cds/container/skip_list_set_nogc.h @@ -357,7 +357,7 @@ namespace cds { namespace container { /// Gets minimum key from the set /** - If the set is empty the function returns \p NULL + If the set is empty the function returns \p nullptr */ value_type * get_min() const { @@ -367,7 +367,7 @@ namespace cds { namespace container { /// Gets maximum key from the set /** - The function returns \p NULL if the set is empty + The function returns \p nullptr if the set is empty */ value_type * get_max() const { diff --git a/cds/container/skip_list_set_rcu.h b/cds/container/skip_list_set_rcu.h index a00db0de..fa3f22bb 100644 --- a/cds/container/skip_list_set_rcu.h +++ b/cds/container/skip_list_set_rcu.h @@ -135,7 +135,7 @@ namespace cds { namespace container { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. */ template < typename RCU, @@ -778,7 +778,7 @@ namespace cds { namespace container { /// Finds \p key and return the item found /** \anchor cds_nonintrusive_SkipListSet_rcu_get The function searches the item with key equal to \p key and returns the pointer to item found. - If \p key is not found it returns \p NULL. + If \p key is not found it returns \p nullptr. Note the compare functor in \p Traits class' template argument should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/container/split_list_map_rcu.h b/cds/container/split_list_map_rcu.h index e7544773..b42ee5bc 100644 --- a/cds/container/split_list_map_rcu.h +++ b/cds/container/split_list_map_rcu.h @@ -66,7 +66,7 @@ namespace cds { namespace container { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. \par Usage @@ -644,7 +644,7 @@ namespace cds { namespace container { /// Finds \p key and return the item found /** \anchor cds_intrusive_SplitListMap_rcu_get The function searches the item with key equal to \p key and returns the pointer to item found. - If \p key is not found it returns \p NULL. + If \p key is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p K that can be not the same as \p value_type. diff --git a/cds/container/split_list_set_rcu.h b/cds/container/split_list_set_rcu.h index 7ca37017..0cd2506d 100644 --- a/cds/container/split_list_set_rcu.h +++ b/cds/container/split_list_set_rcu.h @@ -66,7 +66,7 @@ namespace cds { namespace container { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. \par Usage @@ -883,7 +883,7 @@ namespace cds { namespace container { /// Finds the key \p val and return the item found /** \anchor cds_nonintrusive_SplitListSet_rcu_get The function searches the item with key equal to \p val and returns the pointer to item found. - If \p val is not found it returns \p NULL. + If \p val is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/container/tsigas_cycle_queue.h b/cds/container/tsigas_cycle_queue.h index 0e905050..64fe4804 100644 --- a/cds/container/tsigas_cycle_queue.h +++ b/cds/container/tsigas_cycle_queue.h @@ -328,7 +328,7 @@ namespace cds { namespace container { /// Clear the queue /** - The function repeatedly calls \ref dequeue until it returns NULL. + The function repeatedly calls \ref dequeue until it returns \p nullptr. */ void clear() { diff --git a/cds/details/bitop_generic.h b/cds/details/bitop_generic.h index 8fed30bd..6fd1a07b 100644 --- a/cds/details/bitop_generic.h +++ b/cds/details/bitop_generic.h @@ -222,7 +222,7 @@ namespace cds { #ifndef cds_bitop_complement32_DEFINED static inline bool complement32( atomic32u_t * pArg, unsigned int nBit ) { - assert( pArg != NULL ); + assert( pArg ); atomic32u_t nVal = *pArg & (1 << nBit); *pArg ^= 1 << nBit; return nVal != 0; @@ -232,7 +232,7 @@ namespace cds { #ifndef cds_bitop_complement64_DEFINED static inline bool complement64( atomic64u_t * pArg, unsigned int nBit ) { - assert( pArg != NULL ); + assert( pArg ); atomic64u_t nVal = *pArg & (atomic64u_t(1) << nBit); *pArg ^= atomic64u_t(1) << nBit; return nVal != 0; diff --git a/cds/details/functor_wrapper.h b/cds/details/functor_wrapper.h index d4882a43..3fb1daff 100644 --- a/cds/details/functor_wrapper.h +++ b/cds/details/functor_wrapper.h @@ -68,7 +68,7 @@ namespace cds { namespace details { func_ref get() { - assert( m_func != NULL ); + assert( m_func ); return *m_func; } }; @@ -86,7 +86,7 @@ namespace cds { namespace details { func_ref get() { - assert( m_func != NULL ); + assert( m_func ); return *m_func; } }; @@ -104,7 +104,7 @@ namespace cds { namespace details { func_ref get() { - assert( m_func != NULL ); + assert( m_func ); return *m_func; } }; @@ -122,7 +122,7 @@ namespace cds { namespace details { func_ref get() { - assert( m_func != NULL ); + assert( m_func ); return *m_func; } }; @@ -140,7 +140,7 @@ namespace cds { namespace details { func_ref get() { - assert( m_func != NULL ); + assert( m_func ); return *m_func; } }; diff --git a/cds/gc/details/retired_ptr.h b/cds/gc/details/retired_ptr.h index da19d1e9..91b490c8 100644 --- a/cds/gc/details/retired_ptr.h +++ b/cds/gc/details/retired_ptr.h @@ -29,10 +29,10 @@ namespace cds { namespace gc { return p1.m_p < p2.m_p; } - /// Default ctor initializes pointer to NULL + /// Default ctor initializes pointer to \p nullptr retired_ptr() - : m_p( NULL ) - , m_funcFree( NULL ) + : m_p( nullptr ) + , m_funcFree( nullptr ) {} /// Ctor @@ -59,8 +59,8 @@ namespace cds { namespace gc { /// Invokes destructor function for the pointer void free() { - assert( m_funcFree != NULL ); - assert( m_p != NULL ); + assert( m_funcFree ); + assert( m_p ); m_funcFree( m_p ); CDS_STRICT_DO( m_p = nullptr ); diff --git a/cds/gc/guarded_ptr.h b/cds/gc/guarded_ptr.h index d59baeed..b5781039 100644 --- a/cds/gc/guarded_ptr.h +++ b/cds/gc/guarded_ptr.h @@ -115,7 +115,7 @@ namespace cds { namespace gc { return *value_cast()( m_guard.template get() ); } - /// Checks if the guarded pointer is \p NULL + /// Checks if the guarded pointer is \p nullptr bool empty() const CDS_NOEXCEPT { return m_guard.template get() == nullptr; diff --git a/cds/gc/hp_decl.h b/cds/gc/hp_decl.h index 4b6d0edc..6c00f4c5 100644 --- a/cds/gc/hp_decl.h +++ b/cds/gc/hp_decl.h @@ -222,6 +222,13 @@ namespace cds { namespace gc { return base_class::operator =(p); } + //@cond + std::nullptr_t assign( std::nullptr_t ) + { + return base_class::operator =(nullptr); + } + //@endcond + /// Copy from \p src guard to \p this guard void copy( Guard const& src ) { @@ -242,7 +249,7 @@ namespace cds { namespace gc { /// Clear value of the guard void clear() { - assign( reinterpret_cast(NULL) ); + assign( nullptr ); } /// Get the value currently protected diff --git a/cds/gc/hrc/hrc.h b/cds/gc/hrc/hrc.h index ff523931..068adecd 100644 --- a/cds/gc/hrc/hrc.h +++ b/cds/gc/hrc/hrc.h @@ -130,7 +130,7 @@ namespace cds { namespace gc { for all x where link[x] of node is reference-counted do retry: node1 := link[x]; - if node1 != NULL and node1.m_bDeleted then + if node1 != nullptr and node1.m_bDeleted then node2 := node1->link[x]; pGC->CASRef( this->link[x], node1, node2 ); pGC->releaseRef( node2 ); @@ -159,11 +159,11 @@ namespace cds { namespace gc { void terminate( ThreadGC * pGC, bool bConcurrent) if !bConcurrent for all this->link where link is reference-counted do - link := NULL; + link := nullptr; else for all this->link where link is reference-counted do repeat node1 := link; - until pGC->CASRef(link,node1,NULL); + until pGC->CASRef(link,node1,nullptr); \endcode */ virtual void terminate( ThreadGC * pGC, bool bConcurrent ) = 0; @@ -262,7 +262,7 @@ namespace cds { namespace gc { #endif }; - /// "Global GC object is NULL" exception + /// "Global GC object is nullptr" exception CDS_DECLARE_EXCEPTION( HRCGarbageCollectorEmpty, "Global cds::gc::hrc::GarbageCollector is NULL" ); /// Not enough required Hazard Pointer count diff --git a/cds/gc/hzp/details/hp_alloc.h b/cds/gc/hzp/details/hp_alloc.h index 7d9d5f15..40561fba 100644 --- a/cds/gc/hzp/details/hp_alloc.h +++ b/cds/gc/hzp/details/hp_alloc.h @@ -56,6 +56,14 @@ namespace cds { return p; } + //@cond + std::nullptr_t operator=( std::nullptr_t ) CDS_NOEXCEPT + { + clear(); + return nullptr; + } + //@endcond + /// Returns current value of hazard pointer /** Loading has acquire semantics @@ -159,7 +167,7 @@ namespace cds { return m_arr[nIndex]; } - /// Clears (sets to NULL) hazard pointer \p nIndex + /// Clears (sets to \p nullptr) hazard pointer \p nIndex void clear( size_t nIndex ) CDS_NOEXCEPT { assert( nIndex < capacity() ); diff --git a/cds/gc/hzp/hzp.h b/cds/gc/hzp/hzp.h index fc3dd20c..27d1cec7 100644 --- a/cds/gc/hzp/hzp.h +++ b/cds/gc/hzp/hzp.h @@ -214,7 +214,7 @@ namespace cds { //@cond hplist_node( const GarbageCollector& HzpMgr ) : HPRec( HzpMgr ), - m_pNextNode(NULL), + m_pNextNode( nullptr ), m_idOwner( OS::c_NullThreadId ), m_bFree( true ) {} @@ -310,7 +310,7 @@ namespace cds { /// Returns pointer to GarbageCollector instance static GarbageCollector& instance() { - if ( m_pHZPManager == NULL ) + if ( !m_pHZPManager ) throw HZPManagerEmpty(); return *m_pHZPManager; } @@ -318,7 +318,7 @@ namespace cds { /// Checks if global GC object is constructed and may be used static bool isUsed() { - return m_pHZPManager != NULL; + return m_pHZPManager != nullptr; } /// Returns max Hazard Pointer count defined in construction time @@ -467,7 +467,7 @@ namespace cds { public: ThreadGC() : m_HzpManager( GarbageCollector::instance() ), - m_pHzpRec( NULL ) + m_pHzpRec( nullptr ) {} ~ThreadGC() { @@ -475,7 +475,7 @@ namespace cds { } /// Checks if thread GC is initialized - bool isInitialized() const { return m_pHzpRec != NULL ; } + bool isInitialized() const { return m_pHzpRec != nullptr; } /// Initialization. Repeat call is available void init() @@ -489,7 +489,7 @@ namespace cds { { if ( m_pHzpRec ) { details::HPRec * pRec = m_pHzpRec; - m_pHzpRec = NULL; + m_pHzpRec = nullptr; m_HzpManager.RetireHPRec( pRec ); } } @@ -497,14 +497,14 @@ namespace cds { /// Initializes HP guard \p guard details::HPGuard& allocGuard() { - assert( m_pHzpRec != NULL ); + assert( m_pHzpRec ); return m_pHzpRec->m_hzp.alloc(); } /// Frees HP guard \p guard void freeGuard( details::HPGuard& guard ) { - assert( m_pHzpRec != NULL ); + assert( m_pHzpRec ); m_pHzpRec->m_hzp.free( guard ); } @@ -512,7 +512,7 @@ namespace cds { template void allocGuard( details::HPArray& arr ) { - assert( m_pHzpRec != NULL ); + assert( m_pHzpRec ); m_pHzpRec->m_hzp.alloc( arr ); } @@ -520,7 +520,7 @@ namespace cds { template void freeGuard( details::HPArray& arr ) { - assert( m_pHzpRec != NULL ); + assert( m_pHzpRec ); m_pHzpRec->m_hzp.free( arr ); } @@ -601,6 +601,11 @@ namespace cds { } //@cond + std::nullptr_t operator =(std::nullptr_t) + { + return m_hp = nullptr; + } + hazard_ptr get() const { return m_hp; diff --git a/cds/gc/ptb/ptb.h b/cds/gc/ptb/ptb.h index 075deafe..b1afc4ff 100644 --- a/cds/gc/ptb/ptb.h +++ b/cds/gc/ptb/ptb.h @@ -526,6 +526,14 @@ namespace cds { namespace gc { return p; } + //@cond + std::nullptr_t operator=(std::nullptr_t) + { + clear(); + return nullptr; + } + //@endcond + public: // for ThreadGC. /* GCC cannot compile code for template versions of ThreasGC::allocGuard/freeGuard, @@ -587,6 +595,13 @@ namespace cds { namespace gc { { return base_class::operator =( p ); } + + //@cond + std::nullptr_t operator=(std::nullptr_t) + { + return base_class::operator =(nullptr); + } + //@endcond }; /// Array of guards @@ -649,7 +664,7 @@ namespace cds { namespace gc { m_arr[nIndex].set( p ); } - /// Clears (sets to NULL) the guard \p nIndex + /// Clears (sets to \p nullptr) the guard \p nIndex void clear( size_t nIndex ) { assert( nIndex < capacity() ); diff --git a/cds/gc/ptb_decl.h b/cds/gc/ptb_decl.h index 790d5858..175e9064 100644 --- a/cds/gc/ptb_decl.h +++ b/cds/gc/ptb_decl.h @@ -224,6 +224,13 @@ namespace cds { namespace gc { return base_class::operator =(p); } + //@cond + std::nullptr_t assign( std::nullptr_t ) + { + return base_class::operator =(nullptr); + } + //@endcond + /// Store marked pointer \p p to the guard /** The function equals to a simple assignment of p.ptr(), no loop is performed. diff --git a/cds/intrusive/basket_queue.h b/cds/intrusive/basket_queue.h index 3d57b46e..ccf89645 100644 --- a/cds/intrusive/basket_queue.h +++ b/cds/intrusive/basket_queue.h @@ -758,7 +758,7 @@ namespace cds { namespace intrusive { /// Dequeues a value from the queue /** @anchor cds_intrusive_BasketQueue_dequeue - If the queue is empty the function returns \p NULL. + If the queue is empty the function returns \p nullptr. Warning: see MSQueue::deque note about item disposing */ @@ -797,7 +797,7 @@ namespace cds { namespace intrusive { /// Clear the queue /** - The function repeatedly calls \ref dequeue until it returns \p NULL. + The function repeatedly calls \ref dequeue until it returns \p nullptr. The disposer defined in template \p Options is called for each item that can be safely disposed. */ diff --git a/cds/intrusive/cuckoo_set.h b/cds/intrusive/cuckoo_set.h index dd07159d..340c4ede 100644 --- a/cds/intrusive/cuckoo_set.h +++ b/cds/intrusive/cuckoo_set.h @@ -1582,9 +1582,9 @@ namespace cds { namespace intrusive { The insert(x) successively "kicks out" conflicting items until every key has a slot. To add \p x, the method swaps \p x with \p y, the current occupant of table[0][h0(x)]. - If the prior value was \p NULL, it is done. Otherwise, it swaps the newly nest-less value \p y + If the prior value was \p nullptr, it is done. Otherwise, it swaps the newly nest-less value \p y for the current occupant of table[1][h1(y)] in the same way. As before, if the prior value - was \p NULL, it is done. Otherwise, the method continues swapping entries (alternating tables) + was \p nullptr, it is done. Otherwise, the method continues swapping entries (alternating tables) until it finds an empty slot. We might not find an empty slot, either because the table is full, or because the sequence of displacement forms a cycle. We therefore need an upper limit on the number of successive displacements we are willing to undertake. When this limit is exceeded, @@ -2596,7 +2596,7 @@ namespace cds { namespace intrusive { The function searches an item with key equal to \p val in the set, unlinks it from the set, and returns a pointer to unlinked item. - If the item with key equal to \p val is not found the function return \p NULL. + If the item with key equal to \p val is not found the function return \p nullptr. Note the hash functor should accept a parameter of type \p Q that can be not the same as \p value_type. */ @@ -2641,7 +2641,7 @@ namespace cds { namespace intrusive { \endcode The functor may be passed by reference with boost:ref - If the item with key equal to \p val is not found the function return \p NULL. + If the item with key equal to \p val is not found the function return \p nullptr. Note the hash functor should accept a parameter of type \p Q that can be not the same as \p value_type. */ diff --git a/cds/intrusive/ellen_bintree_rcu.h b/cds/intrusive/ellen_bintree_rcu.h index 5d9c35b6..3a817091 100644 --- a/cds/intrusive/ellen_bintree_rcu.h +++ b/cds/intrusive/ellen_bintree_rcu.h @@ -1258,7 +1258,7 @@ namespace cds { namespace intrusive { /// Finds \p key and return the item found /** \anchor cds_intrusive_EllenBinTree_rcu_get The function searches the item with key equal to \p key and returns the pointer to item found. - If \p key is not found it returns \p NULL. + If \p key is not found it returns \p nullptr. RCU should be locked before call the function. Returned pointer is valid while RCU is locked. diff --git a/cds/intrusive/lazy_list_base.h b/cds/intrusive/lazy_list_base.h index c6558cbb..f2ee2bb7 100644 --- a/cds/intrusive/lazy_list_base.h +++ b/cds/intrusive/lazy_list_base.h @@ -171,9 +171,9 @@ namespace cds { namespace intrusive { typedef Node node_type; //@endcond - /// Checks if the link field of node \p pNode is NULL + /// Checks if the link field of node \p pNode is \p nullptr /** - An asserting is generated if \p pNode link field is not NULL + An asserting is generated if \p pNode link field is not \p nullptr */ static void is_empty( node_type const * pNode ) { diff --git a/cds/intrusive/lazy_list_nogc.h b/cds/intrusive/lazy_list_nogc.h index da544691..ca43491f 100644 --- a/cds/intrusive/lazy_list_nogc.h +++ b/cds/intrusive/lazy_list_nogc.h @@ -446,7 +446,7 @@ namespace cds { namespace intrusive { /// Finds the key \p val /** \anchor cds_intrusive_LazyList_nogc_find_val The function searches the item with key equal to \p val - and returns pointer to value found or \p NULL. + and returns pointer to value found or \p nullptr. */ template value_type * find( Q const& val ) diff --git a/cds/intrusive/lazy_list_rcu.h b/cds/intrusive/lazy_list_rcu.h index 32e41b1d..7e15553d 100644 --- a/cds/intrusive/lazy_list_rcu.h +++ b/cds/intrusive/lazy_list_rcu.h @@ -771,7 +771,7 @@ namespace cds { namespace intrusive { /// Finds the key \p val and return the item found /** \anchor cds_intrusive_LazyList_rcu_get The function searches the item with key equal to \p val and returns the pointer to item found. - If \p val is not found it returns \p NULL. + If \p val is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/intrusive/michael_deque.h b/cds/intrusive/michael_deque.h index 539d3f44..d9d2af4a 100644 --- a/cds/intrusive/michael_deque.h +++ b/cds/intrusive/michael_deque.h @@ -915,7 +915,7 @@ namespace cds { namespace intrusive { /// Pop back /** - Pops rightmost item from the deque. If the deque is empty then returns \p NULL. + Pops rightmost item from the deque. If the deque is empty then returns \p nullptr. For popped object the disposer specified in \p Options template parameters is called. */ @@ -932,7 +932,7 @@ namespace cds { namespace intrusive { /// Pop front /** - Pops leftmost item from the deque. If the deque is empty then returns \p NULL. + Pops leftmost item from the deque. If the deque is empty then returns \p nullptr. For popped object the disposer specified in \p Options template parameters is called. */ @@ -969,7 +969,7 @@ namespace cds { namespace intrusive { /// Clear the deque /** - The function repeatedly calls \ref pop_back until it returns \p NULL. + The function repeatedly calls \ref pop_back until it returns \p nullptr. The disposer defined in template \p Options is called for each item that can be safely disposed. */ diff --git a/cds/intrusive/michael_list_base.h b/cds/intrusive/michael_list_base.h index 29927ea7..39ccaa55 100644 --- a/cds/intrusive/michael_list_base.h +++ b/cds/intrusive/michael_list_base.h @@ -123,9 +123,9 @@ namespace cds { namespace intrusive { typedef Node node_type; //@endcond - /// Checks if the link field of node \p pNode is \p NULL + /// Checks if the link field of node \p pNode is \p nullptr /** - An asserting is generated if \p pNode link field is not \p NULL + An asserting is generated if \p pNode link field is not \p nullptr */ static void is_empty( const node_type * pNode ) { diff --git a/cds/intrusive/michael_list_hrc.h b/cds/intrusive/michael_list_hrc.h index b2aea04f..f3a783fb 100644 --- a/cds/intrusive/michael_list_hrc.h +++ b/cds/intrusive/michael_list_hrc.h @@ -26,7 +26,7 @@ namespace cds { namespace intrusive { namespace michael_list { protected: virtual void cleanUp( cds::gc::hrc::ThreadGC * pGC ) { - assert( pGC != NULL ); + assert( pGC ); typename gc::GuardArray<2> aGuards( *pGC ); while ( true ) { diff --git a/cds/intrusive/michael_list_impl.h b/cds/intrusive/michael_list_impl.h index 479690f1..4fd358bc 100644 --- a/cds/intrusive/michael_list_impl.h +++ b/cds/intrusive/michael_list_impl.h @@ -467,7 +467,7 @@ namespace cds { namespace intrusive { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to NULL. + Internally, end returning value equals to \p nullptr. The returned value can be used only to control reaching the end of the list. For empty list begin() == end() diff --git a/cds/intrusive/michael_list_nogc.h b/cds/intrusive/michael_list_nogc.h index 7b8b7990..67952fba 100644 --- a/cds/intrusive/michael_list_nogc.h +++ b/cds/intrusive/michael_list_nogc.h @@ -236,7 +236,7 @@ namespace cds { namespace intrusive { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to NULL. + Internally, end returning value equals to \p nullptr. The returned value can be used only to control reaching the end of the list. For empty list \code begin() == end() \endcode @@ -410,7 +410,7 @@ namespace cds { namespace intrusive { /// Finds the key \p val /** \anchor cds_intrusive_MichaelList_nogc_find_val The function searches the item with key equal to \p val - and returns pointer to value found or \p NULL. + and returns pointer to value found or \p nullptr. */ template value_type * find( Q const & val ) diff --git a/cds/intrusive/michael_list_rcu.h b/cds/intrusive/michael_list_rcu.h index f54c1f21..c19953e4 100644 --- a/cds/intrusive/michael_list_rcu.h +++ b/cds/intrusive/michael_list_rcu.h @@ -288,7 +288,7 @@ namespace cds { namespace intrusive { /// Returns an iterator that addresses the location succeeding the last element in a list /** Do not use the value returned by end function to access any item. - Internally, end returning value equals to \p NULL. + Internally, end returning value equals to \p nullptr. The returned value can be used only to control reaching the end of the list. For empty list \code begin() == end() \endcode @@ -678,7 +678,7 @@ namespace cds { namespace intrusive { /// Finds the key \p val and return the item found /** \anchor cds_intrusive_MichaelList_rcu_get The function searches the item with key equal to \p val and returns the pointer to item found. - If \p val is not found it returns \p NULL. + If \p val is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/intrusive/michael_set_nogc.h b/cds/intrusive/michael_set_nogc.h index 51efe380..1196c128 100644 --- a/cds/intrusive/michael_set_nogc.h +++ b/cds/intrusive/michael_set_nogc.h @@ -224,7 +224,7 @@ namespace cds { namespace intrusive { /// Finds the key \p val /** \anchor cds_intrusive_MichaelHashSet_nogc_find_val The function searches the item with key equal to \p val - and returns pointer to item found, otherwise \p NULL. + and returns pointer to item found, otherwise \p nullptr. Note the hash functor specified for class \p Traits template parameter should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/intrusive/michael_set_rcu.h b/cds/intrusive/michael_set_rcu.h index 8e130023..d155e93d 100644 --- a/cds/intrusive/michael_set_rcu.h +++ b/cds/intrusive/michael_set_rcu.h @@ -583,7 +583,7 @@ namespace cds { namespace intrusive { /// Finds the key \p val and return the item found /** \anchor cds_intrusive_MichaelHashSet_rcu_get The function searches the item with key equal to \p val and returns the pointer to item found. - If \p val is not found it returns \p NULL. + If \p val is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/intrusive/msqueue.h b/cds/intrusive/msqueue.h index fc52400a..67f51d4d 100644 --- a/cds/intrusive/msqueue.h +++ b/cds/intrusive/msqueue.h @@ -356,7 +356,7 @@ namespace cds { namespace intrusive { /// Dequeues a value from the queue /** @anchor cds_intrusive_MSQueue_dequeue - If the queue is empty the function returns \p NULL. + If the queue is empty the function returns \p nullptr. \par Warning The queue algorithm has following feature: when \p dequeue is called, @@ -411,7 +411,7 @@ namespace cds { namespace intrusive { /// Clear the queue /** - The function repeatedly calls \ref dequeue until it returns \p NULL. + The function repeatedly calls \ref dequeue until it returns \p nullptr. The disposer defined in template \p Options is called for each item that can be safely disposed. */ diff --git a/cds/intrusive/node_traits.h b/cds/intrusive/node_traits.h index 6dda1f37..0f2c8c6d 100644 --- a/cds/intrusive/node_traits.h +++ b/cds/intrusive/node_traits.h @@ -64,7 +64,7 @@ namespace cds { namespace intrusive { } static node_type * to_node_ptr( value_type * v ) { - return v ? static_cast( v ) : reinterpret_cast( NULL ); + return v ? static_cast(v) : nullptr; } static const node_type * to_node_ptr( const value_type& v ) { @@ -72,7 +72,7 @@ namespace cds { namespace intrusive { } static const node_type * to_node_ptr( const value_type * v ) { - return v ? static_cast( v ) : reinterpret_cast( NULL ); + return v ? static_cast(v) : nullptr; } static value_type * to_value_ptr( node_type& n ) { @@ -80,7 +80,7 @@ namespace cds { namespace intrusive { } static value_type * to_value_ptr( node_type * n ) { - return n ? static_cast( n ) : reinterpret_cast( NULL ); + return n ? static_cast(n) : nullptr; } static const value_type * to_value_ptr( const node_type& n ) { @@ -88,7 +88,7 @@ namespace cds { namespace intrusive { } static const value_type * to_value_ptr( const node_type * n ) { - return n ? static_cast( n ) : reinterpret_cast( NULL ); + return n ? static_cast(n) : nullptr; } }; @@ -104,7 +104,7 @@ namespace cds { namespace intrusive { } static node_type * to_node_ptr( value_type * v ) { - return v ? to_node_ptr(*v) : reinterpret_cast( NULL ); + return v ? to_node_ptr( *v ) : nullptr; } static const node_type * to_node_ptr( const value_type& v ) { @@ -112,7 +112,7 @@ namespace cds { namespace intrusive { } static const node_type * to_node_ptr( const value_type * v ) { - return v ? to_node_ptr(*v) : reinterpret_cast( NULL ); + return v ? to_node_ptr( *v ) : nullptr; } static value_type * to_value_ptr( node_type& n ) { @@ -120,7 +120,7 @@ namespace cds { namespace intrusive { } static value_type * to_value_ptr( node_type * n ) { - return n ? to_value_ptr(*n) : reinterpret_cast( NULL ); + return n ? to_value_ptr( *n ) : nullptr; } static const value_type * to_value_ptr( const node_type& n ) { @@ -128,7 +128,7 @@ namespace cds { namespace intrusive { } static const value_type * to_value_ptr( const node_type * n ) { - return n ? to_value_ptr(*n) : reinterpret_cast( NULL ); + return n ? to_value_ptr( *n ) : nullptr; } }; diff --git a/cds/intrusive/optimistic_queue.h b/cds/intrusive/optimistic_queue.h index 1b072b1b..eda9ce20 100644 --- a/cds/intrusive/optimistic_queue.h +++ b/cds/intrusive/optimistic_queue.h @@ -111,9 +111,9 @@ namespace cds { namespace intrusive { typedef Node node_type; //@endcond - /// Checks if the link fields of node \p pNode is NULL + /// Checks if the link fields of node \p pNode is \p nullptr /** - An asserting is generated if \p pNode link fields is not NULL + An asserting is generated if \p pNode link fields is not \p nullptr */ static void is_empty( const node_type * pNode ) { @@ -528,7 +528,7 @@ namespace cds { namespace intrusive { /// Dequeues a value from the queue /** @anchor cds_intrusive_OptimisticQueue_dequeue - If the queue is empty the function returns \a NULL + If the queue is empty the function returns \p nullptr \par Warning The queue algorithm has following feature: when \p dequeue is called, @@ -581,7 +581,7 @@ namespace cds { namespace intrusive { /// Clear the stack /** - The function repeatedly calls \ref dequeue until it returns NULL. + The function repeatedly calls \ref dequeue until it returns \p nullptr. The disposer defined in template \p Options is called for each item that can be safely disposed. */ diff --git a/cds/intrusive/options.h b/cds/intrusive/options.h index 5478b797..3d7ec403 100644 --- a/cds/intrusive/options.h +++ b/cds/intrusive/options.h @@ -81,7 +81,7 @@ namespace cds { namespace intrusive { - \ref always_check_link - check in debug and release build (not yet implemented for release mode). When link checking is on, the container tests that the node's link fields - must be NULL before inserting the item. If the link is not NULL an assertion is generated + must be \p nullptr before inserting the item. If the link is not \p nullptr an assertion is generated */ template struct link_checker { diff --git a/cds/intrusive/single_link_struct.h b/cds/intrusive/single_link_struct.h index eea61765..324409ab 100644 --- a/cds/intrusive/single_link_struct.h +++ b/cds/intrusive/single_link_struct.h @@ -160,9 +160,9 @@ namespace cds { namespace intrusive { typedef Node node_type; //@endcond - /// Checks if the link field of node \p pNode is NULL + /// Checks if the link field of node \p pNode is \p nullptr /** - An asserting is generated if \p pNode link field is not NULL + An asserting is generated if \p pNode link field is not \p nullptr */ static void is_empty( const node_type * pNode ) { diff --git a/cds/intrusive/skip_list_base.h b/cds/intrusive/skip_list_base.h index 36af85e6..9e048e6e 100644 --- a/cds/intrusive/skip_list_base.h +++ b/cds/intrusive/skip_list_base.h @@ -40,7 +40,7 @@ namespace cds { namespace intrusive { protected: atomic_marked_ptr m_pNext ; ///< Next item in bottom-list (list at level 0) unsigned int m_nHeight ; ///< Node height (size of m_arrNext array). For node at level 0 the height is 1. - atomic_marked_ptr * m_arrNext ; ///< Array of next items for levels 1 .. m_nHeight - 1. For node at level 0 \p m_arrNext is \p NULL + atomic_marked_ptr * m_arrNext ; ///< Array of next items for levels 1 .. m_nHeight - 1. For node at level 0 \p m_arrNext is \p nullptr public: /// Constructs a node of height 1 (a bottom-list node) diff --git a/cds/intrusive/skip_list_hrc.h b/cds/intrusive/skip_list_hrc.h index 15973a94..a283915d 100644 --- a/cds/intrusive/skip_list_hrc.h +++ b/cds/intrusive/skip_list_hrc.h @@ -23,7 +23,7 @@ namespace cds { namespace intrusive { namespace skip_list { protected: atomic_marked_ptr m_pNext ; ///< Next item in bottom-list (list at level 0) unsigned int m_nHeight ; ///< Node height (size of m_arrNext array). For node at level 0 the height is 1. - atomic_marked_ptr * m_arrNext ; ///< Array of next items for levels 1 .. m_nHeight - 1. For node at level 0 \p m_arrNext is \p NULL + atomic_marked_ptr * m_arrNext ; ///< Array of next items for levels 1 .. m_nHeight - 1. For node at level 0 \p m_arrNext is \p nullptr public: bool m_bDel; @@ -112,7 +112,7 @@ namespace cds { namespace intrusive { namespace skip_list { protected: virtual void cleanUp( cds::gc::hrc::ThreadGC * pGC ) { - assert( pGC != NULL ); + assert( pGC ); typename gc::GuardArray<2> aGuards( *pGC ); unsigned int const nHeight = height(); diff --git a/cds/intrusive/skip_list_impl.h b/cds/intrusive/skip_list_impl.h index a2c19d25..b19fb52f 100644 --- a/cds/intrusive/skip_list_impl.h +++ b/cds/intrusive/skip_list_impl.h @@ -260,7 +260,7 @@ namespace cds { namespace intrusive { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. How to use diff --git a/cds/intrusive/skip_list_nogc.h b/cds/intrusive/skip_list_nogc.h index 112e1b27..b5e6c97d 100644 --- a/cds/intrusive/skip_list_nogc.h +++ b/cds/intrusive/skip_list_nogc.h @@ -28,7 +28,7 @@ namespace cds { namespace intrusive { protected: atomic_ptr m_pNext ; ///< Next item in bottom-list (list at level 0) unsigned int m_nHeight ; ///< Node height (size of m_arrNext array). For node at level 0 the height is 1. - atomic_ptr * m_arrNext ; ///< Array of next items for levels 1 .. m_nHeight - 1. For node at level 0 \p m_arrNext is \p NULL + atomic_ptr * m_arrNext ; ///< Array of next items for levels 1 .. m_nHeight - 1. For node at level 0 \p m_arrNext is \p nullptr public: /// Constructs a node of height 1 (a bottom-list node) @@ -264,7 +264,7 @@ namespace cds { namespace intrusive { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. How to use @@ -944,7 +944,7 @@ namespace cds { namespace intrusive { /// Gets minimum key from the set /** - If the set is empty the function returns \p NULL + If the set is empty the function returns \p nullptr */ value_type * get_min() const { @@ -953,7 +953,7 @@ namespace cds { namespace intrusive { /// Gets maximum key from the set /** - The function returns \p NULL if the set is empty + The function returns \p nullptr if the set is empty */ value_type * get_max() const { diff --git a/cds/intrusive/skip_list_rcu.h b/cds/intrusive/skip_list_rcu.h index d6d08839..3fb6778c 100644 --- a/cds/intrusive/skip_list_rcu.h +++ b/cds/intrusive/skip_list_rcu.h @@ -42,7 +42,7 @@ namespace cds { namespace intrusive { # endif protected: unsigned int m_nHeight ; ///< Node height (size of m_arrNext array). For node at level 0 the height is 1. - atomic_marked_ptr * m_arrNext ; ///< Array of next items for levels 1 .. m_nHeight - 1. For node at level 0 \p m_arrNext is \p NULL + atomic_marked_ptr * m_arrNext ; ///< Array of next items for levels 1 .. m_nHeight - 1. For node at level 0 \p m_arrNext is \p nullptr public: /// Constructs a node of height 1 (a bottom-list node) @@ -423,7 +423,7 @@ namespace cds { namespace intrusive { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p NULL and should not be dereferenced. + Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. How to use @@ -674,7 +674,7 @@ namespace cds { namespace intrusive { static void dispose_node( value_type * pVal ) { - assert( pVal != NULL ); + assert( pVal ); typename node_builder::node_disposer()( node_traits::to_node_ptr(pVal) ); disposer()( pVal ); @@ -2080,7 +2080,7 @@ retry: /// Finds the key \p val and return the item found /** \anchor cds_intrusive_SkipListSet_rcu_get The function searches the item with key equal to \p val and returns the pointer to item found. - If \p val is not found it returns \p NULL. + If \p val is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/intrusive/split_list_nogc.h b/cds/intrusive/split_list_nogc.h index 6ed3ffe7..8d664096 100644 --- a/cds/intrusive/split_list_nogc.h +++ b/cds/intrusive/split_list_nogc.h @@ -327,7 +327,7 @@ namespace cds { namespace intrusive { /// Finds the key \p val /** \anchor cds_intrusive_SplitListSet_nogc_find_val The function searches the item with key equal to \p val - and returns pointer to item found or , and \p NULL otherwise. + and returns pointer to item found or , and \p nullptr otherwise. Note the hash functor specified for class \p Traits template parameter should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/intrusive/split_list_rcu.h b/cds/intrusive/split_list_rcu.h index 7401f18c..92be12f7 100644 --- a/cds/intrusive/split_list_rcu.h +++ b/cds/intrusive/split_list_rcu.h @@ -851,7 +851,7 @@ namespace cds { namespace intrusive { /// Finds the key \p val and return the item found /** \anchor cds_intrusive_SplitListSet_rcu_get The function searches the item with key equal to \p val and returns the pointer to item found. - If \p val is not found it returns \p NULL. + If \p val is not found it returns \p nullptr. Note the compare functor should accept a parameter of type \p Q that can be not the same as \p value_type. diff --git a/cds/intrusive/striped_set.h b/cds/intrusive/striped_set.h index 6ad3231e..54525ec7 100644 --- a/cds/intrusive/striped_set.h +++ b/cds/intrusive/striped_set.h @@ -606,7 +606,7 @@ namespace cds { namespace intrusive { The function searches an item with key equal to \p val in the set, unlinks it from the set, and returns a pointer to unlinked item. - If the item with key equal to \p val is not found the function return \p NULL. + If the item with key equal to \p val is not found the function return \p nullptr. Note the hash functor should accept a parameter of type \p Q that can be not the same as \p value_type. */ diff --git a/cds/intrusive/treiber_stack.h b/cds/intrusive/treiber_stack.h index 34ea027a..dfb549d5 100644 --- a/cds/intrusive/treiber_stack.h +++ b/cds/intrusive/treiber_stack.h @@ -399,10 +399,10 @@ namespace cds { namespace intrusive { myData * p; p = s1.pop() ; // pop i1 from s1 - p = s1.pop() ; // p == NULL, s1 is empty + p = s1.pop() ; // p == nullptr, s1 is empty p = s2.pop() ; // pop i1 from s2 p = s2.pop() ; // pop i2 from s2 - p = s2.pop() ; // p == NULL, s2 is empty + p = s2.pop() ; // p == nullptr, s2 is empty } \endcode @@ -598,7 +598,7 @@ namespace cds { namespace intrusive { /// Pop an item from the stack /** - If stack is empty, returns \p NULL. + If stack is empty, returns \p nullptr. The disposer is not called for popped item. See \ref cds_intrusive_item_destroying "Destroying items of intrusive containers". */ @@ -627,7 +627,7 @@ namespace cds { namespace intrusive { m_stat.onPopRace(); if ( m_Backoff.backoff( op, m_stat )) { - // may return NULL if stack is empty + // may return nullptr if stack is empty return op.pVal; } } diff --git a/cds/intrusive/tsigas_cycle_queue.h b/cds/intrusive/tsigas_cycle_queue.h index ac240517..01822729 100644 --- a/cds/intrusive/tsigas_cycle_queue.h +++ b/cds/intrusive/tsigas_cycle_queue.h @@ -241,7 +241,7 @@ namespace cds { namespace intrusive { /// Dequeues item from the queue /** @anchor cds_intrusive_TsigasQueue_dequeue - If the queue is empty the function returns \a NULL + If the queue is empty the function returns \p nullptr Dequeue does not call value disposer. You can manually dispose returned value if it is needed. */ @@ -261,9 +261,9 @@ namespace cds { namespace intrusive { if ( th != m_nHead.load(memory_model::memory_order_relaxed) ) goto TryAgain; - // two consecutive NULL means queue empty + // two consecutive nullptr means queue empty if ( temp == m_nTail.load(memory_model::memory_order_acquire) ) - return NULL; + return nullptr; temp = ( temp + 1 ) & nModulo; tt = m_buffer[ temp ].load(memory_model::memory_order_relaxed); @@ -325,7 +325,7 @@ namespace cds { namespace intrusive { while ( is_free( tt ) ) { if ( th != m_nHead.load(memory_model::memory_order_relaxed) ) goto TryAgain; - // two consecutive NULL means queue empty + // two consecutive nullptr means queue empty if ( temp == m_nTail.load(memory_model::memory_order_relaxed) ) return true; temp = ( temp + 1 ) & nModulo; diff --git a/cds/intrusive/vyukov_mpmc_cycle_queue.h b/cds/intrusive/vyukov_mpmc_cycle_queue.h index 1b049bf5..6dcd5029 100644 --- a/cds/intrusive/vyukov_mpmc_cycle_queue.h +++ b/cds/intrusive/vyukov_mpmc_cycle_queue.h @@ -98,7 +98,7 @@ namespace cds { namespace intrusive { /// Dequeues an item from queue /** - If queue is empty, returns \p NULL. + If queue is empty, returns \p nullptr. */ value_type * dequeue() { diff --git a/cds/lock/array.h b/cds/lock/array.h index 0829a8fb..7a62c033 100644 --- a/cds/lock/array.h +++ b/cds/lock/array.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include diff --git a/cds/memory/michael/allocator.h b/cds/memory/michael/allocator.h index abd3706d..d6ce92d7 100644 --- a/cds/memory/michael/allocator.h +++ b/cds/memory/michael/allocator.h @@ -961,7 +961,7 @@ namespace michael { /// Processor heap's \p active field /** The \p active field in the processor heap structure is primarily a pointer to the descriptor - of the active superblock owned by the processor heap. If the value of \p active is not \p NULL, it is + of the active superblock owned by the processor heap. If the value of \p active is not \p nullptr, it is guaranteed that the active superblock has at least one block available for reservation. Since the addresses of superblock descriptors can be guaranteed to be aligned to some power of 2 (e.g., 64), as an optimization, we can carve a credits subfield to hold the number @@ -969,7 +969,7 @@ namespace michael { of credits is n, then the active superblock contains n+1 blocks available for reservation through the \p active field. Note that the number of blocks in a superblock is not limited to the maximum reservations that can be held in the credits subfield. In a typical malloc operation - (i.e., when \p active != \p NULL and \p credits > 0), the thread reads \p active and then + (i.e., when \p active != \p nullptr and \p credits > 0), the thread reads \p active and then atomically decrements credits while validating that the active superblock is still valid. */ class active_tag { @@ -1102,7 +1102,7 @@ namespace michael { CDS_DATA_ALIGNMENT(8) CDS_ATOMIC::atomic active; ///< pointer to the descriptor of active superblock owned by processor heap processor_desc * pProcDesc ; ///< pointer to parent processor descriptor const size_class * pSizeClass ; ///< pointer to size class - CDS_ATOMIC::atomic pPartial ; ///< pointer to partial filled superblock (may be NULL) + CDS_ATOMIC::atomic pPartial ; ///< pointer to partial filled superblock (may be \p nullptr) partial_list partialList ; ///< list of partial filled superblocks owned by the processor heap unsigned int nPageIdx ; ///< page size-class index, \ref c_nPageSelfAllocation - "small page" @@ -1138,8 +1138,8 @@ namespace michael { } } while ( !pPartial.compare_exchange_weak( pDesc, nullptr, CDS_ATOMIC::memory_order_release, CDS_ATOMIC::memory_order_relaxed ) ); - //assert( pDesc == NULL || free_desc_list::node_algorithms::inited( static_cast(pDesc) )); - //assert( pDesc == NULL || partial_desc_list::node_algorithms::inited( static_cast(pDesc) ) ); + //assert( pDesc == nullptr || free_desc_list::node_algorithms::inited( static_cast(pDesc) )); + //assert( pDesc == nullptr || partial_desc_list::node_algorithms::inited( static_cast(pDesc) ) ); return pDesc; } @@ -1776,13 +1776,13 @@ namespace michael { /// Reallocate memory block /** If \p nNewSize is zero, then the block pointed to by \p pMemory is freed; - the return value is \p NULL, and \p pMemory is left pointing at a freed block. + the return value is \p nullptr, and \p pMemory is left pointing at a freed block. If there is not enough available memory to expand the block to the given size, - the original block is left unchanged, and \p NULL is returned. + the original block is left unchanged, and \p nullptr is returned. Aligned memory block cannot be realloc'ed: if \p pMemory has been allocated by \ref alloc_aligned, - then the return value is \p NULL and the original block is left unchanged. + then the return value is \p nullptr and the original block is left unchanged. */ void * realloc( void * pMemory, ///< Pointer to previously allocated memory block diff --git a/cds/opt/value_cleaner.h b/cds/opt/value_cleaner.h index 6dd8e0b8..560498d2 100644 --- a/cds/opt/value_cleaner.h +++ b/cds/opt/value_cleaner.h @@ -12,7 +12,7 @@ namespace cds { namespace opt { The cleaner is a functor called when an item is removed from a container. Note, the cleaner should not delete (deallocate) the value \p val passed in. However, if the \p value_type type is a structure that contains dynamically allocated - field(s), the cleaning functor may deallocate it and iniitalize to default value (usually, \p NULL). + field(s), the cleaning functor may deallocate it and iniitalize to default value (usually, \p nullptr). The interface for type \p value_type is: \code diff --git a/cds/os/alloc_aligned.h b/cds/os/alloc_aligned.h index 06c0e63c..ec4ed8fd 100644 --- a/cds/os/alloc_aligned.h +++ b/cds/os/alloc_aligned.h @@ -25,7 +25,7 @@ #include #include -#include +#include namespace cds { /// OS specific wrappers diff --git a/cds/os/free_bsd/topology.h b/cds/os/free_bsd/topology.h index f67bb461..6a7d2c85 100644 --- a/cds/os/free_bsd/topology.h +++ b/cds/os/free_bsd/topology.h @@ -42,7 +42,7 @@ namespace cds { namespace OS { size_t len = sizeof(nCPU); /* get the number of CPUs from the system */ - return ::sysctl(mib, 2, &nCPU, &len, NULL, 0) == 0 && nCPU > 0 ? (unsigned int) nCPU : 1; + return ::sysctl( mib, 2, &nCPU, &len, nullptr, 0 ) == 0 && nCPU > 0 ? (unsigned int)nCPU : 1; } /// Get current processor number diff --git a/cds/os/posix/alloc_aligned.h b/cds/os/posix/alloc_aligned.h index b5c53202..664063f7 100644 --- a/cds/os/posix/alloc_aligned.h +++ b/cds/os/posix/alloc_aligned.h @@ -22,7 +22,7 @@ namespace cds { namespace OS { ) { void * pMem; - return ::posix_memalign( &pMem, nAlignment, nSize ) == 0 ? pMem : NULL; + return ::posix_memalign( &pMem, nAlignment, nSize ) == 0 ? pMem : nullptr; } /// Frees a block of memory that was allocated with aligned_malloc. diff --git a/cds/os/posix/thread.h b/cds/os/posix/thread.h index 76592ca8..45be131e 100644 --- a/cds/os/posix/thread.h +++ b/cds/os/posix/thread.h @@ -4,32 +4,29 @@ #define __CDS_OS_POSIX_THREAD_H #include +#include namespace cds { namespace OS { /// posix-related wrappers namespace posix { /// Posix thread id type - typedef std::thread::native_thread_handle ThreadId; + typedef std::thread::native_handle_type ThreadId; /// Get current thread id - static inline ThreadId getCurrentThreadId() { return pthread_self(); } + static inline ThreadId getCurrentThreadId() + { + return pthread_self(); + } /// Checks if thread \p id is alive static inline bool isThreadAlive( ThreadId id ) { // if sig is zero, error checking is performed but no signal is actually sent. // ESRCH - No thread could be found corresponding to that specified by the given thread ID - // Unresolved problem: Linux may crash on dead thread_id. Workaround unknown (except signal handler...) + // Unresolved problem: Linux may crash on dead thread_id. Workaround unknown (except signal handler...) return pthread_kill( id, 0 ) != ESRCH; } - - /// Default back-off thread strategy (yield) - static inline void backoff() - { - std::this_thread::yield(); - } - } // namespace posix using posix::ThreadId; @@ -37,7 +34,6 @@ namespace cds { namespace OS { using posix::getCurrentThreadId; using posix::isThreadAlive; - using posix::backoff; }} // namespace cds::OS diff --git a/cds/os/thread.h b/cds/os/thread.h index 316c0860..e78a575f 100644 --- a/cds/os/thread.h +++ b/cds/os/thread.h @@ -12,4 +12,13 @@ # include #endif +namespace cds { namespace OS { + + /// Default backoff::yield implementation + static inline void backoff() + { + std::this_thread::yield(); + } +}} // namespace cds::OS + #endif // #ifndef __CDS_OS_THREAD_H diff --git a/cds/os/win/syserror.h b/cds/os/win/syserror.h index 31c6048a..26491e05 100644 --- a/cds/os/win/syserror.h +++ b/cds/os/win/syserror.h @@ -23,7 +23,7 @@ namespace cds { namespace OS { { char *ptmp = 0; if ( !FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, nCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &ptmp, 0, 0 ) diff --git a/cds/os/win/thread.h b/cds/os/win/thread.h index 85877573..0098bd8a 100644 --- a/cds/os/win/thread.h +++ b/cds/os/win/thread.h @@ -22,17 +22,11 @@ namespace cds { namespace OS { static inline bool isThreadAlive( ThreadId id ) { HANDLE h = ::OpenThread( SYNCHRONIZE, FALSE, id ); - if ( h == NULL ) + if ( h == nullptr ) return false; ::CloseHandle( h ); return true; } - - /// Default backoff::yield implementation - static inline void backoff() - { - std::this_thread::yield(); - } } // namespace Win32 using Win32::ThreadId; @@ -40,7 +34,6 @@ namespace cds { namespace OS { using Win32::getCurrentThreadId; using Win32::isThreadAlive; - using Win32::backoff; }} // namespace cds::OS diff --git a/cds/threading/details/_common.h b/cds/threading/details/_common.h index be0acb49..8c295d85 100644 --- a/cds/threading/details/_common.h +++ b/cds/threading/details/_common.h @@ -147,12 +147,12 @@ namespace cds { //@cond ThreadData() - : m_pGPIRCU( NULL ) - , m_pGPBRCU( NULL ) - , m_pGPTRCU( NULL ) + : m_pGPIRCU( nullptr ) + , m_pGPBRCU( nullptr ) + , m_pGPTRCU( nullptr ) #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - , m_pSHBRCU( NULL ) - , m_pSHTRCU( NULL ) + , m_pSHBRCU( nullptr ) + , m_pSHTRCU( nullptr ) #endif , m_nFakeProcessorNumber( s_nLastUsedProcNo.fetch_add(1, CDS_ATOMIC::memory_order_relaxed) % s_nProcCount ) , m_nAttachCount(0) @@ -193,12 +193,12 @@ namespace cds { m_ptbManager = nullptr; } - assert( m_pGPIRCU == NULL ); - assert( m_pGPBRCU == NULL ); - assert( m_pGPTRCU == NULL ); + assert( m_pGPIRCU == nullptr ); + assert( m_pGPBRCU == nullptr ); + assert( m_pGPTRCU == nullptr ); #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - assert( m_pSHBRCU == NULL ); - assert( m_pSHTRCU == NULL ); + assert( m_pSHBRCU == nullptr ); + assert( m_pSHTRCU == nullptr ); #endif } @@ -239,24 +239,24 @@ namespace cds { if ( cds::urcu::details::singleton::isUsed() ) { cds::urcu::details::singleton::detach_thread( m_pGPIRCU ); - m_pGPIRCU = NULL; + m_pGPIRCU = nullptr; } if ( cds::urcu::details::singleton::isUsed() ) { cds::urcu::details::singleton::detach_thread( m_pGPBRCU ); - m_pGPBRCU = NULL; + m_pGPBRCU = nullptr; } if ( cds::urcu::details::singleton::isUsed() ) { cds::urcu::details::singleton::detach_thread( m_pGPTRCU ); - m_pGPTRCU = NULL; + m_pGPTRCU = nullptr; } #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED if ( cds::urcu::details::singleton::isUsed() ) { cds::urcu::details::singleton::detach_thread( m_pSHBRCU ); - m_pSHBRCU = NULL; + m_pSHBRCU = nullptr; } if ( cds::urcu::details::singleton::isUsed() ) { cds::urcu::details::singleton::detach_thread( m_pSHTRCU ); - m_pSHTRCU = NULL; + m_pSHTRCU = nullptr; } #endif return true; diff --git a/cds/threading/details/cxx11_manager.h b/cds/threading/details/cxx11_manager.h index 9d34fd11..c2f05a1a 100644 --- a/cds/threading/details/cxx11_manager.h +++ b/cds/threading/details/cxx11_manager.h @@ -45,7 +45,7 @@ namespace cds { namespace threading { { if ( cxx11_internal::s_pThreadData ) { ThreadData * p = cxx11_internal::s_pThreadData; - cxx11_internal::s_pThreadData = NULL; + cxx11_internal::s_pThreadData = nullptr; p->ThreadData::~ThreadData(); } } @@ -69,7 +69,7 @@ namespace cds { namespace threading { /// Checks whether current thread is attached to \p libcds feature or not. static bool isThreadAttached() { - return _threadData() != NULL; + return _threadData() != nullptr; } /// This method must be called in beginning of thread execution @@ -103,7 +103,7 @@ namespace cds { namespace threading { */ static gc::HP::thread_gc_impl& getHZPGC() { - assert( _threadData()->m_hpManager != NULL ); + assert( _threadData()->m_hpManager != nullptr ); return *(_threadData()->m_hpManager); } @@ -115,7 +115,7 @@ namespace cds { namespace threading { */ static gc::HRC::thread_gc_impl& getHRCGC() { - assert( _threadData()->m_hrcManager != NULL ); + assert( _threadData()->m_hrcManager != nullptr ); return *(_threadData()->m_hrcManager); } @@ -127,7 +127,7 @@ namespace cds { namespace threading { */ static gc::PTB::thread_gc_impl& getPTBGC() { - assert( _threadData()->m_ptbManager != NULL ); + assert( _threadData()->m_ptbManager != nullptr ); return *(_threadData()->m_ptbManager); } diff --git a/cds/threading/details/gcc_manager.h b/cds/threading/details/gcc_manager.h index 4baacf09..dbf1588f 100644 --- a/cds/threading/details/gcc_manager.h +++ b/cds/threading/details/gcc_manager.h @@ -45,7 +45,7 @@ namespace cds { namespace threading { { if ( gcc_internal::s_pThreadData ) { ThreadData * p = gcc_internal::s_pThreadData; - gcc_internal::s_pThreadData = NULL; + gcc_internal::s_pThreadData = nullptr; p->ThreadData::~ThreadData(); } } @@ -69,7 +69,7 @@ namespace cds { namespace threading { /// Checks whether current thread is attached to \p libcds feature or not. static bool isThreadAttached() { - return _threadData() != NULL; + return _threadData() != nullptr; } /// This method must be called in beginning of thread execution @@ -103,7 +103,7 @@ namespace cds { namespace threading { */ static gc::HP::thread_gc_impl& getHZPGC() { - assert( _threadData()->m_hpManager != NULL ); + assert( _threadData()->m_hpManager ); return *(_threadData()->m_hpManager); } @@ -115,7 +115,7 @@ namespace cds { namespace threading { */ static gc::HRC::thread_gc_impl& getHRCGC() { - assert( _threadData()->m_hrcManager != NULL ); + assert( _threadData()->m_hrcManager ); return *(_threadData()->m_hrcManager); } @@ -127,7 +127,7 @@ namespace cds { namespace threading { */ static gc::PTB::thread_gc_impl& getPTBGC() { - assert( _threadData()->m_ptbManager != NULL ); + assert( _threadData()->m_ptbManager ); return *(_threadData()->m_ptbManager); } diff --git a/cds/threading/details/msvc_manager.h b/cds/threading/details/msvc_manager.h index f6f5a313..da29e9c1 100644 --- a/cds/threading/details/msvc_manager.h +++ b/cds/threading/details/msvc_manager.h @@ -44,7 +44,7 @@ namespace cds { namespace threading { { if ( msvc_internal::s_pThreadData ) { msvc_internal::s_pThreadData->ThreadData::~ThreadData(); - msvc_internal::s_pThreadData = NULL; + msvc_internal::s_pThreadData = nullptr; } } @@ -69,7 +69,7 @@ namespace cds { namespace threading { static bool isThreadAttached() { ThreadData * pData = _threadData(); - return pData != NULL; + return pData != nullptr; } /// This method must be called in beginning of thread execution @@ -103,7 +103,7 @@ namespace cds { namespace threading { */ static gc::HP::thread_gc_impl& getHZPGC() { - assert( _threadData()->m_hpManager != NULL ); + assert( _threadData()->m_hpManager ); return *(_threadData()->m_hpManager); } @@ -115,7 +115,7 @@ namespace cds { namespace threading { */ static gc::HRC::thread_gc_impl& getHRCGC() { - assert( _threadData()->m_hrcManager != NULL ); + assert( _threadData()->m_hrcManager ); return *(_threadData()->m_hrcManager); } @@ -127,7 +127,7 @@ namespace cds { namespace threading { */ static gc::PTB::thread_gc_impl& getPTBGC() { - assert( _threadData()->m_ptbManager != NULL ); + assert( _threadData()->m_ptbManager ); return *(_threadData()->m_ptbManager); } diff --git a/cds/threading/details/pthread_manager.h b/cds/threading/details/pthread_manager.h index 3ed88ccd..fbc97059 100644 --- a/cds/threading/details/pthread_manager.h +++ b/cds/threading/details/pthread_manager.h @@ -79,7 +79,7 @@ namespace cds { namespace threading { static void free() { ThreadData * p = get(); - pthread_setspecific( m_key, NULL ); + pthread_setspecific( m_key, nullptr ); if ( p ) delete p; } @@ -106,12 +106,12 @@ namespace cds { namespace threading { case do_checkData: return Holder::get(); case do_attachThread: - if ( Holder::get() == NULL ) + if ( Holder::get() == nullptr ) Holder::alloc(); return Holder::get(); case do_detachThread: Holder::free(); - return NULL; + return nullptr; case init_holder: case fini_holder: break; @@ -119,7 +119,7 @@ namespace cds { namespace threading { assert( false ) ; // anything forgotten?.. } assert(false) ; // how did we get here? - return NULL; + return nullptr; } //@endcond @@ -145,12 +145,12 @@ namespace cds { namespace threading { /// Checks whether current thread is attached to \p libcds feature or not. static bool isThreadAttached() { - return _threadData( do_checkData ) != NULL; + return _threadData( do_checkData ) != nullptr; } /// This method must be called in beginning of thread execution /** - If TLS pointer to manager's data is NULL, pthread_exception is thrown + If TLS pointer to manager's data is \p nullptr, pthread_exception is thrown with code = -1. If an error occurs in call of pthread API function, pthread_exception is thrown with pthread error code. @@ -158,7 +158,7 @@ namespace cds { namespace threading { static void attachThread() { ThreadData * pData = _threadData( do_attachThread ); - assert( pData != NULL ); + assert( pData ); if ( pData ) { pData->init(); @@ -169,7 +169,7 @@ namespace cds { namespace threading { /// This method must be called in end of thread execution /** - If TLS pointer to manager's data is NULL, pthread_exception is thrown + If TLS pointer to manager's data is \p nullptr, pthread_exception is thrown with code = -1. If an error occurs in call of pthread API function, pthread_exception is thrown with pthread error code. @@ -177,7 +177,7 @@ namespace cds { namespace threading { static void detachThread() { ThreadData * pData = _threadData( do_getData ); - assert( pData != NULL ); + assert( pData ); if ( pData ) { if ( pData->fini() ) diff --git a/cds/threading/details/wintls_manager.h b/cds/threading/details/wintls_manager.h index 18fd32b7..f6bb3efb 100644 --- a/cds/threading/details/wintls_manager.h +++ b/cds/threading/details/wintls_manager.h @@ -75,7 +75,7 @@ namespace cds { namespace threading { { api_error_code nErr; void * pData = ::TlsGetValue( m_key ); - if ( pData == NULL && (nErr = ::GetLastError()) != ERROR_SUCCESS ) + if ( pData == nullptr && (nErr = ::GetLastError()) != ERROR_SUCCESS ) throw api_exception( nErr, "TlsGetValue" ); return reinterpret_cast( pData ); } @@ -89,7 +89,7 @@ namespace cds { namespace threading { static void free() { ThreadData * p = get(); - ::TlsSetValue( m_key, NULL ); + ::TlsSetValue( m_key, nullptr ); if ( p ) delete p; } @@ -104,7 +104,7 @@ namespace cds { namespace threading { # ifdef _DEBUG { ThreadData * p = Holder::get(); - assert( p != NULL ); + assert( p ); return p; } # else @@ -113,16 +113,16 @@ namespace cds { namespace threading { case do_checkData: return Holder::get(); case do_attachThread: - if ( Holder::get() == NULL ) + if ( Holder::get() == nullptr ) Holder::alloc(); return Holder::get(); case do_detachThread: Holder::free(); - return NULL; + return nullptr; default: assert( false ) ; // anything forgotten?.. } - return NULL; + return nullptr; } //@endcond @@ -148,12 +148,12 @@ namespace cds { namespace threading { /// Checks whether current thread is attached to \p libcds feature or not. static bool isThreadAttached() { - return _threadData( do_checkData ) != NULL; + return _threadData( do_checkData ) != nullptr; } /// This method must be called in beginning of thread execution /** - If TLS pointer to manager's data is NULL, api_exception is thrown + If TLS pointer to manager's data is \p nullptr, api_exception is thrown with code = -1. If an error occurs in call of Win TLS API function, api_exception is thrown with Windows error code. @@ -161,7 +161,7 @@ namespace cds { namespace threading { static void attachThread() { ThreadData * pData = _threadData( do_attachThread ); - assert( pData != NULL ); + assert( pData ); if ( pData ) { pData->init(); @@ -172,7 +172,7 @@ namespace cds { namespace threading { /// This method must be called in end of thread execution /** - If TLS pointer to manager's data is NULL, api_exception is thrown + If TLS pointer to manager's data is \p nullptr, api_exception is thrown with code = -1. If an error occurs in call of Win TLS API function, api_exception is thrown with Windows error code. @@ -180,7 +180,7 @@ namespace cds { namespace threading { static void detachThread() { ThreadData * pData = _threadData( do_getData ); - assert( pData != NULL ); + assert( pData ); if ( pData ) { if ( pData->fini() ) diff --git a/cds/threading/model.h b/cds/threading/model.h index 620654a7..bbc1c47a 100644 --- a/cds/threading/model.h +++ b/cds/threading/model.h @@ -78,13 +78,13 @@ namespace cds { namespace threading { inline cds::urcu::details::thread_data * getRCU() { ThreadData * p = Manager::thread_data(); - return p ? p->m_pSHBRCU : NULL; + return p ? p->m_pSHBRCU : nullptr; } template<> inline cds::urcu::details::thread_data * getRCU() { ThreadData * p = Manager::thread_data(); - return p ? p->m_pSHTRCU : NULL; + return p ? p->m_pSHTRCU : nullptr; } #endif diff --git a/cds/urcu/details/gp_decl.h b/cds/urcu/details/gp_decl.h index f04cf816..f764e727 100644 --- a/cds/urcu/details/gp_decl.h +++ b/cds/urcu/details/gp_decl.h @@ -120,7 +120,7 @@ namespace cds { namespace urcu { namespace details { static bool isUsed() { - return rcu_instance::s_pRCU != NULL; + return rcu_instance::s_pRCU != nullptr; } public: diff --git a/cds/urcu/details/sh.h b/cds/urcu/details/sh.h index 25e5642e..6ef1fada 100644 --- a/cds/urcu/details/sh.h +++ b/cds/urcu/details/sh.h @@ -3,6 +3,7 @@ #ifndef _CDS_URCU_DETAILS_SH_H #define _CDS_URCU_DETAILS_SH_H +#include //memset #include #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED @@ -86,7 +87,7 @@ namespace cds { namespace urcu { namespace details { sigaction( m_nSigNo, &sigact, nullptr ); sigaddset( &sigact.sa_mask, m_nSigNo ); - pthread_sigmask( SIG_UNBLOCK, &sigact.sa_mask, NULL ); + pthread_sigmask( SIG_UNBLOCK, &sigact.sa_mask, nullptr ); } template diff --git a/cds/urcu/details/sh_decl.h b/cds/urcu/details/sh_decl.h index 1386e606..9fc21c7a 100644 --- a/cds/urcu/details/sh_decl.h +++ b/cds/urcu/details/sh_decl.h @@ -128,7 +128,7 @@ namespace cds { namespace urcu { namespace details { static bool isUsed() { - return rcu_instance::s_pRCU != NULL; + return rcu_instance::s_pRCU != nullptr; } int signal_no() const diff --git a/cds/urcu/exempt_ptr.h b/cds/urcu/exempt_ptr.h index 963ec152..5d65455b 100644 --- a/cds/urcu/exempt_ptr.h +++ b/cds/urcu/exempt_ptr.h @@ -91,7 +91,7 @@ namespace cds { namespace urcu { release(); } - /// Checks if the pointer is \p NULL + /// Checks if the pointer is \p nullptr bool empty() const CDS_NOEXCEPT { return m_pNode == nullptr; @@ -170,7 +170,7 @@ namespace cds { namespace urcu { release(); } - /// Checks if the pointer is \p NULL + /// Checks if the pointer is \p nullptr bool empty() const CDS_NOEXCEPT { return m_pNode == nullptr; diff --git a/projects/Win/vc12/cds.vcxproj b/projects/Win/vc12/cds.vcxproj index 74b6c0e4..cbe75f79 100644 --- a/projects/Win/vc12/cds.vcxproj +++ b/projects/Win/vc12/cds.vcxproj @@ -639,6 +639,7 @@ + @@ -775,6 +776,8 @@ + + diff --git a/projects/Win/vc12/cds.vcxproj.filters b/projects/Win/vc12/cds.vcxproj.filters index b91956f0..bcc6dba9 100644 --- a/projects/Win/vc12/cds.vcxproj.filters +++ b/projects/Win/vc12/cds.vcxproj.filters @@ -1295,5 +1295,14 @@ Header Files\cds\algo + + Header Files\cds\algo + + + Header Files\cds\lock + + + Header Files\cds\lock + \ No newline at end of file diff --git a/src/dllmain.cpp b/src/dllmain.cpp index 1fc9b85c..14ce22e4 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -14,7 +14,7 @@ #endif static cds::OS::ThreadId s_MainThreadId = 0; -static HINSTANCE s_DllInstance = NULL; +static HINSTANCE s_DllInstance = nullptr; #if _WIN32_WINNT < 0x0601 // For Windows below Windows 7 @@ -28,7 +28,7 @@ static unsigned int s_nProcessorGroupCount = 1; // Array of processor - cell relationship // Array size is s_nProcessorCount // s_arrProcessorCellRelationship[i] is the cell (the processor group) number for i-th processor -// static unsigned int * s_arrProcessorCellRelationship = NULL; +// static unsigned int * s_arrProcessorCellRelationship = nullptr; static void discover_topology() { @@ -38,8 +38,8 @@ static void discover_topology() LPFN_GLPI glpi; bool bDone = false; - PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = NULL; - PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = NULL; + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = nullptr; + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = nullptr; DWORD returnLength = 0; DWORD logicalProcessorCount = 0; DWORD numaNodeCount = 0; @@ -51,7 +51,7 @@ static void discover_topology() s_nProcessorGroupCount = 1; glpi = (LPFN_GLPI) GetProcAddress( GetModuleHandle("kernel32"), "GetLogicalProcessorInformation" ); - if (NULL == glpi) { + if ( glpi == nullptr ) { return; } @@ -66,7 +66,7 @@ static void discover_topology() buffer = reinterpret_cast( ::malloc( returnLength ) ); - if (NULL == buffer) { + if ( buffer == nullptr ) { // allocation failed return; } @@ -167,14 +167,14 @@ namespace cds { namespace OS { namespace Win32 { static void prepare_current_processor_call() { s_fnGetCurrentProcessorNumber = (fnGetCurrentProcessorNumber) GetProcAddress( GetModuleHandle("kernel32"), "GetCurrentProcessorNumber" ); - if ( s_fnGetCurrentProcessorNumber == NULL ) + if ( s_fnGetCurrentProcessorNumber == nullptr ) s_fnGetCurrentProcessorNumber = (fnGetCurrentProcessorNumber) GetProcAddress( GetModuleHandle("ntdll"), "NtGetCurrentProcessorNumber" ); } namespace cds { namespace OS { namespace Win32 { unsigned int topology::current_processor() { - if ( s_fnGetCurrentProcessorNumber != NULL ) + if ( s_fnGetCurrentProcessorNumber != nullptr ) return s_fnGetCurrentProcessorNumber(); return 0; } @@ -203,9 +203,9 @@ BOOL WINAPI DllMain( case DLL_PROCESS_DETACH: /* #if _WIN32_WINNT < 0x0601 - if ( s_arrProcessorCellRelationship != NULL ) { + if ( s_arrProcessorCellRelationship != nullptr ) { delete [] s_arrProcessorCellRelationship; - s_arrProcessorCellRelationship = NULL; + s_arrProcessorCellRelationship = nullptr; } #endif */ diff --git a/src/hzp_gc.cpp b/src/hzp_gc.cpp index 5c0be168..5f38bafc 100644 --- a/src/hzp_gc.cpp +++ b/src/hzp_gc.cpp @@ -22,7 +22,7 @@ namespace cds { namespace gc { /// Max array size of retired pointers static const size_t c_nMaxRetireNodeCount = c_nHazardPointerPerThread * c_nMaxThreadCount * 2; - GarbageCollector * GarbageCollector::m_pHZPManager = NULL; + GarbageCollector * GarbageCollector::m_pHZPManager = nullptr; void CDS_STDCALL GarbageCollector::Construct( size_t nHazardPtrCount, size_t nMaxThreadCount, size_t nMaxRetiredPtrCount, scan_type nScanType ) { @@ -38,7 +38,7 @@ namespace cds { namespace gc { m_pHZPManager->detachAllThread(); delete m_pHZPManager; - m_pHZPManager = NULL; + m_pHZPManager = nullptr; } } @@ -48,7 +48,7 @@ namespace cds { namespace gc { size_t nMaxRetiredPtrCount, scan_type nScanType ) - : m_pListHead(NULL) + : m_pListHead( nullptr ) ,m_bStatEnabled( true ) ,m_nHazardPointerCount( nHazardPtrCount == 0 ? c_nHazardPointerPerThread : nHazardPtrCount ) ,m_nMaxThreadCount( nMaxThreadCount == 0 ? c_nMaxThreadCount : nMaxThreadCount ) @@ -64,7 +64,7 @@ namespace cds { namespace gc { hplist_node * pHead = m_pListHead.load( CDS_ATOMIC::memory_order_relaxed ); m_pListHead.store( nullptr, CDS_ATOMIC::memory_order_relaxed ); - hplist_node * pNext = NULL; + hplist_node * pNext = nullptr; for ( hplist_node * hprec = pHead; hprec; hprec = pNext ) { assert( hprec->m_idOwner.load( CDS_ATOMIC::memory_order_relaxed ) == nullThreadId || hprec->m_idOwner.load( CDS_ATOMIC::memory_order_relaxed ) == mainThreadId @@ -138,7 +138,7 @@ namespace cds { namespace gc { void GarbageCollector::RetireHPRec( details::HPRec * pRec ) { - assert( pRec != NULL ); + assert( pRec != nullptr ); CDS_HAZARDPTR_STATISTIC( ++m_Stat.m_RetireHPRec ); pRec->clear(); @@ -149,7 +149,7 @@ namespace cds { namespace gc { void GarbageCollector::detachAllThread() { - hplist_node * pNext = NULL; + hplist_node * pNext = nullptr; const cds::OS::ThreadId nullThreadId = cds::OS::c_NullThreadId; for ( hplist_node * hprec = m_pListHead.load(CDS_ATOMIC::memory_order_acquire); hprec; hprec = pNext ) { pNext = hprec->m_pNextNode; diff --git a/src/init.cpp b/src/init.cpp index 9d534364..7168e6c5 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -28,20 +28,20 @@ namespace cds { CDS_EXPORT_API DWORD cds::threading::wintls::Manager::Holder::m_key = TLS_OUT_OF_INDEXES; __declspec( thread ) threading::msvc_internal::ThreadDataPlaceholder threading::msvc_internal::s_threadData; - __declspec( thread ) threading::ThreadData * threading::msvc_internal::s_pThreadData = NULL; + __declspec(thread) threading::ThreadData * threading::msvc_internal::s_pThreadData = nullptr; #else pthread_key_t threading::pthread::Manager::Holder::m_key; # if CDS_COMPILER == CDS_COMPILER_GCC || CDS_COMPILER == CDS_COMPILER_CLANG __thread threading::gcc_internal::ThreadDataPlaceholder CDS_DATA_ALIGNMENT(8) threading::gcc_internal::s_threadData; - __thread threading::ThreadData * threading::gcc_internal::s_pThreadData = NULL; + __thread threading::ThreadData * threading::gcc_internal::s_pThreadData = nullptr; # endif #endif #ifdef CDS_CXX11_THREAD_LOCAL_SUPPORT thread_local threading::cxx11_internal::ThreadDataPlaceholder CDS_DATA_ALIGNMENT(8) threading::cxx11_internal::s_threadData; - thread_local threading::ThreadData * threading::cxx11_internal::s_pThreadData = NULL; + thread_local threading::ThreadData * threading::cxx11_internal::s_pThreadData = nullptr; #endif namespace details { diff --git a/src/ptb_gc.cpp b/src/ptb_gc.cpp index 9a11b0bf..bce91256 100644 --- a/src/ptb_gc.cpp +++ b/src/ptb_gc.cpp @@ -133,7 +133,7 @@ namespace cds { namespace gc { namespace ptb { }; } - GarbageCollector * GarbageCollector::m_pManager = NULL; + GarbageCollector * GarbageCollector::m_pManager = nullptr; void CDS_STDCALL GarbageCollector::Construct( size_t nLiberateThreshold @@ -149,7 +149,7 @@ namespace cds { namespace gc { namespace ptb { { if ( m_pManager ) { delete m_pManager; - m_pManager = NULL; + m_pManager = nullptr; } } diff --git a/src/topology_hpux.cpp b/src/topology_hpux.cpp index 68a951a1..cc73f979 100644 --- a/src/topology_hpux.cpp +++ b/src/topology_hpux.cpp @@ -10,7 +10,7 @@ namespace cds { namespace OS { CDS_CXX11_INLINE_NAMESPACE namespace Hpux { size_t topology::s_nProcMapSize = 0; - topology::processor_map * topology::s_procMap = NULL; + topology::processor_map * topology::s_procMap = nullptr; void topology::make_processor_map() { @@ -60,17 +60,17 @@ namespace cds { namespace OS { CDS_CXX11_INLINE_NAMESPACE namespace Hpux { void topology::init() { - assert( s_procMap == NULL ); + assert( s_procMap == nullptr ); make_processor_map(); } void topology::fini() { - assert( s_procMap != NULL ); + assert( s_procMap ); if ( s_procMap ) { ::free( s_procMap ); - s_procMap = NULL; + s_procMap = nullptr; } } diff --git a/src/topology_osx.cpp b/src/topology_osx.cpp index 689dbbfd..76334b67 100644 --- a/src/topology_osx.cpp +++ b/src/topology_osx.cpp @@ -14,7 +14,7 @@ namespace cds { namespace OS { CDS_CXX11_INLINE_NAMESPACE namespace OS_X { void topology::init() { size_t len = sizeof( s_nProcessorCount ); - if ( sysctlbyname("hw.logicalcpu", &s_nProcessorCount, &len, NULL, 0 ) != 0 ) + if ( sysctlbyname("hw.logicalcpu", &s_nProcessorCount, &len, nullptr, 0 ) != 0 ) s_nProcessorCount = 1; } diff --git a/tests/cppunit/cppunit_mini.h b/tests/cppunit/cppunit_mini.h index 89517eab..0a2666e0 100644 --- a/tests/cppunit/cppunit_mini.h +++ b/tests/cppunit/cppunit_mini.h @@ -140,7 +140,7 @@ namespace CppUnitMini static TestCase * current_test() { - assert( m_pCurTestCase != NULL ); + assert( m_pCurTestCase ); return m_pCurTestCase; } diff --git a/tests/cppunit/test_main.cpp b/tests/cppunit/test_main.cpp index b22cf0c1..6a563520 100644 --- a/tests/cppunit/test_main.cpp +++ b/tests/cppunit/test_main.cpp @@ -110,7 +110,7 @@ namespace CppUnitMini std::string TestCase::m_strTestDataDir("."); Config TestCase::m_Cfg; - TestCase * TestCase::m_pCurTestCase = NULL; + TestCase * TestCase::m_pCurTestCase = nullptr; TestCase *TestCase::m_root = 0; Reporter *TestCase::m_reporter = 0; @@ -172,7 +172,7 @@ namespace CppUnitMini char buf[ 4096 ]; - TestCfg * pMap = NULL; + TestCfg * pMap = nullptr; while ( !s.eof() ) { s.getline( buf, sizeof(buf)/sizeof(buf[0]) ); char * pszStr = buf; diff --git a/tests/cppunit/thread.h b/tests/cppunit/thread.h index 535463fe..4c066b90 100644 --- a/tests/cppunit/thread.h +++ b/tests/cppunit/thread.h @@ -38,7 +38,7 @@ namespace CppUnitMini { TestThread( TestThread& src ) : m_Pool( src.m_Pool ) - , m_pThread( NULL ) + , m_pThread( nullptr ) , m_bTimeElapsed( false ) , m_nDuration( 0 ) , m_nThreadNo( 0 ) @@ -77,7 +77,7 @@ namespace CppUnitMini { public: TestThread( ThreadPool& pool ) : m_Pool( pool ) - , m_pThread( NULL ) + , m_pThread( nullptr ) , m_nDuration( 0 ) , m_nThreadNo( 0 ) {} @@ -103,8 +103,8 @@ namespace CppUnitMini { public: ThreadPool( TestCase& tc ) : m_Test( tc ) - , m_pBarrierStart( NULL ) - , m_pBarrierDone( NULL ) + , m_pBarrierStart( nullptr ) + , m_pBarrierDone( nullptr ) {} ~ThreadPool(); diff --git a/tests/test-hdr/deque/hdr_intrusive_deque.h b/tests/test-hdr/deque/hdr_intrusive_deque.h index 8f887d94..016b4846 100644 --- a/tests/test-hdr/deque/hdr_intrusive_deque.h +++ b/tests/test-hdr/deque/hdr_intrusive_deque.h @@ -76,7 +76,7 @@ namespace deque { value_type * pv; pv = q.pop_back(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 1 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 2 )); @@ -86,7 +86,7 @@ namespace deque { pv = q.pop_back(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 2 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 1 )); @@ -96,7 +96,7 @@ namespace deque { pv = q.pop_back(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 3 ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 0 )); @@ -106,7 +106,7 @@ namespace deque { pv = q.pop_back(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv == NULL ); + CPPUNIT_ASSERT( pv == nullptr ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 0 )); CPPUNIT_ASSERT( v1.nDisposeCount == 1 ); @@ -131,7 +131,7 @@ namespace deque { pv = q.pop_front(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 1 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 2 )); @@ -141,7 +141,7 @@ namespace deque { pv = q.pop_front(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 2 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 1 )); @@ -151,7 +151,7 @@ namespace deque { pv = q.pop_front(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 3 ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 0 )); @@ -161,7 +161,7 @@ namespace deque { pv = q.pop_front(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv == NULL ); + CPPUNIT_ASSERT( pv == nullptr ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 0 )); CPPUNIT_ASSERT( v1.nDisposeCount == 2 ); @@ -186,7 +186,7 @@ namespace deque { pv = q.pop_back(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 3 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 2 )); @@ -196,7 +196,7 @@ namespace deque { pv = q.pop_back(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 2 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 1 )); @@ -206,7 +206,7 @@ namespace deque { pv = q.pop_back(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 1 ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 0 )); @@ -216,7 +216,7 @@ namespace deque { pv = q.pop_back(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv == NULL ); + CPPUNIT_ASSERT( pv == nullptr ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 0 )); CPPUNIT_ASSERT( v1.nDisposeCount == 3 ); @@ -241,7 +241,7 @@ namespace deque { pv = q.pop_front(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 3 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 2 )); @@ -251,7 +251,7 @@ namespace deque { pv = q.pop_front(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 2 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 1 )); @@ -261,7 +261,7 @@ namespace deque { pv = q.pop_front(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 1 ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 0 )); @@ -271,7 +271,7 @@ namespace deque { pv = q.pop_front(); Deque::gc::scan(); - CPPUNIT_ASSERT( pv == NULL ); + CPPUNIT_ASSERT( pv == nullptr ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_ASSERT( check_ic( q.size(), 0 )); CPPUNIT_ASSERT( v1.nDisposeCount == 4 ); diff --git a/tests/test-hdr/map/hdr_map.h b/tests/test-hdr/map/hdr_map.h index 95cb980b..e48d3127 100644 --- a/tests/test-hdr/map/hdr_map.h +++ b/tests/test-hdr/map/hdr_map.h @@ -284,7 +284,7 @@ namespace map { { rcu_lock l; pVal = m.get( nKey ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->first == nKey ); CPPUNIT_CHECK( pVal->second.m_val == nKey ); @@ -296,13 +296,13 @@ namespace map { ep.release(); { rcu_lock l; - CPPUNIT_CHECK( m.get( nKey ) == NULL ); + CPPUNIT_CHECK( m.get( nKey ) == nullptr ); CPPUNIT_CHECK( !m.extract( ep, nKey )); CPPUNIT_CHECK( ep.empty() ); nKey = arr[i+1]; pVal = m.get_with( other_item(nKey), other_less() ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->first == nKey ); CPPUNIT_CHECK( pVal->second.m_val == nKey ); @@ -314,7 +314,7 @@ namespace map { ep.release(); { rcu_lock l; - CPPUNIT_CHECK( m.get_with( other_item(nKey), other_less() ) == NULL ); + CPPUNIT_CHECK( m.get_with( other_item(nKey), other_less() ) == nullptr ); CPPUNIT_CHECK( !m.extract_with( ep, other_item(nKey), other_less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -323,7 +323,7 @@ namespace map { CPPUNIT_CHECK( check_size( m, 0 )); { rcu_lock l; - CPPUNIT_CHECK( m.get( int(nLimit / 2) ) == NULL ); + CPPUNIT_CHECK( m.get( int(nLimit / 2) ) == nullptr ); CPPUNIT_CHECK( !m.extract( ep, int(nLimit / 2) )); CPPUNIT_CHECK( ep.empty() ); } diff --git a/tests/test-hdr/map/hdr_skiplist_map.h b/tests/test-hdr/map/hdr_skiplist_map.h index 7314395b..52cc8f47 100644 --- a/tests/test-hdr/map/hdr_skiplist_map.h +++ b/tests/test-hdr/map/hdr_skiplist_map.h @@ -218,7 +218,7 @@ namespace map { CPPUNIT_ASSERT( m.empty()); } - CPPUNIT_MSG( PrintStat()(m, NULL) ); + CPPUNIT_MSG( PrintStat()(m, nullptr) ); } template @@ -334,15 +334,15 @@ namespace map { CPPUNIT_ASSERT( m.insert( i, i * 2 ) != m.end() ); typename Map::value_type * pVal = m.get_min(); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->first == i ); CPPUNIT_CHECK( pVal->second.m_val == i * 2 ); } m.clear(); CPPUNIT_ASSERT( m.empty() ); CPPUNIT_ASSERT( check_size( m, 0 )); - CPPUNIT_CHECK( m.get_min() == NULL ); - CPPUNIT_CHECK( m.get_max() == NULL ); + CPPUNIT_CHECK( m.get_min() == nullptr ); + CPPUNIT_CHECK( m.get_max() == nullptr ); // iterator test @@ -350,7 +350,7 @@ namespace map { CPPUNIT_ASSERT( m.insert( i, i * 2 ) != m.end() ); typename Map::value_type * pVal = m.get_max(); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->first == i ); CPPUNIT_CHECK( pVal->second.m_val == i * 2 ); } diff --git a/tests/test-hdr/map/hdr_skiplist_map_rcu.h b/tests/test-hdr/map/hdr_skiplist_map_rcu.h index f55c6efc..f4cd7b51 100644 --- a/tests/test-hdr/map/hdr_skiplist_map_rcu.h +++ b/tests/test-hdr/map/hdr_skiplist_map_rcu.h @@ -169,7 +169,7 @@ namespace map { { rcu_lock l; value_type * pVal = m.get( nKey ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->first == nKey ); CPPUNIT_CHECK( pVal->second.m_val == nKey * 2 ); } @@ -182,7 +182,7 @@ namespace map { { rcu_lock l; - CPPUNIT_CHECK( m.get( nKey ) == NULL ); + CPPUNIT_CHECK( m.get( nKey ) == nullptr ); } CPPUNIT_CHECK( !m.extract(ep, nKey) ); } @@ -197,7 +197,7 @@ namespace map { { rcu_lock l; value_type * pVal = m.get_with( wrapped_item(nKey), wrapped_less() ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->first == nKey ); CPPUNIT_CHECK( pVal->second.m_val == nKey * 2 ); } @@ -210,7 +210,7 @@ namespace map { { rcu_lock l; - CPPUNIT_CHECK( m.get_with( wrapped_item(nKey), wrapped_less() ) == NULL ); + CPPUNIT_CHECK( m.get_with( wrapped_item(nKey), wrapped_less() ) == nullptr ); } CPPUNIT_CHECK( !m.extract_with(ep, wrapped_item(nKey), wrapped_less()) ); } @@ -243,7 +243,7 @@ namespace map { CPPUNIT_CHECK( !m.extract_max(ep) ); } - CPPUNIT_MSG( PrintStat()(m, NULL) ); + CPPUNIT_MSG( PrintStat()(m, nullptr) ); } public: diff --git a/tests/test-hdr/misc/allocator_test.cpp b/tests/test-hdr/misc/allocator_test.cpp index 463ba448..6eee19c2 100644 --- a/tests/test-hdr/misc/allocator_test.cpp +++ b/tests/test-hdr/misc/allocator_test.cpp @@ -29,8 +29,8 @@ namespace misc { size_t nCurIdx = 0; while ( nTotalAllocated < s_nAllocPerPass ) { size_t nSize = m_arrSize[nCurIdx] + 4; - char * p = a.allocate( nSize, NULL ); - CPPUNIT_ASSERT( p != NULL ); + char * p = a.allocate( nSize, nullptr ); + CPPUNIT_ASSERT( p != nullptr ); memset( p, 0x96, nSize ); nTotalAllocated += nSize; a.deallocate( p, 1 ); @@ -67,14 +67,14 @@ namespace misc { for ( size_t nPass = 0; nPass < s_nPassCount; ++nPass ) { unsigned long long nTotalAllocated = 0; - char * pHead = a.allocate( sizeof(void *), NULL ); - CPPUNIT_ASSERT( pHead != NULL ); + char * pHead = a.allocate( sizeof(void *), nullptr ); + CPPUNIT_ASSERT( pHead != nullptr ); char * pCur = pHead; size_t nCurIdx = 0; while ( nTotalAllocated < s_nAllocPerPass ) { size_t nSize = m_arrSize[nCurIdx] + sizeof(void *); - char * p = a.allocate( nSize, NULL ); - CPPUNIT_ASSERT( p != NULL ); + char * p = a.allocate( nSize, nullptr ); + CPPUNIT_ASSERT( p != nullptr ); memset( p, 0x96, nSize ); *((char **) pCur) = p; pCur = p; @@ -82,10 +82,10 @@ namespace misc { if ( ++nCurIdx > s_nArrSizeSize ) nCurIdx = 0; } - *((char **) pCur) = NULL; + *((char **) pCur) = nullptr; pCur = pHead; - while ( pCur != NULL ) { + while ( pCur != nullptr ) { char * pNext = *((char **) pCur); a.deallocate( pCur, 0 ); pCur = pNext; diff --git a/tests/test-hdr/ordered_list/hdr_intrusive_lazy.h b/tests/test-hdr/ordered_list/hdr_intrusive_lazy.h index a016f644..7d845e1e 100644 --- a/tests/test-hdr/ordered_list/hdr_intrusive_lazy.h +++ b/tests/test-hdr/ordered_list/hdr_intrusive_lazy.h @@ -548,7 +548,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get( a[i] ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->nKey == a[i] ); CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); @@ -560,7 +560,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[i]) == NULL ); + CPPUNIT_CHECK( l.get( a[i] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[i] ) ); CPPUNIT_CHECK( ep.empty() ); } @@ -569,7 +569,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[0] ) == NULL ); + CPPUNIT_CHECK( l.get( a[0] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[0] )); CPPUNIT_CHECK( ep.empty() ); } @@ -586,7 +586,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->nKey == a[i] ); CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); @@ -598,7 +598,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( itm, other_less()) == NULL ); + CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, itm, other_less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -607,7 +607,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( other_item(0), other_less() ) == NULL ); + CPPUNIT_CHECK( l.get_with( other_item( 0 ), other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, other_item(0), other_less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -635,8 +635,8 @@ namespace ordlist { CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - CPPUNIT_ASSERT( l.find_with( v2.key(), less() ) == NULL ); - CPPUNIT_ASSERT( l.find( v3.key() ) == NULL ); + CPPUNIT_ASSERT( l.find_with( v2.key(), less() ) == nullptr ); + CPPUNIT_ASSERT( l.find( v3.key() ) == nullptr ); CPPUNIT_ASSERT( !l.empty() ); //CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is raised diff --git a/tests/test-hdr/ordered_list/hdr_intrusive_michael.h b/tests/test-hdr/ordered_list/hdr_intrusive_michael.h index ed76a10d..b3a42da9 100644 --- a/tests/test-hdr/ordered_list/hdr_intrusive_michael.h +++ b/tests/test-hdr/ordered_list/hdr_intrusive_michael.h @@ -223,7 +223,7 @@ namespace ordlist { CPPUNIT_ASSERT( !l.find_with( v3.key(), less() )); CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is not raised since pNext is NULL + CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is not raised since pNext is nullptr { value_type v( v1 ); @@ -566,7 +566,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get( a[i] ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->nKey == a[i] ); CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); @@ -578,7 +578,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[i]) == NULL ); + CPPUNIT_CHECK( l.get( a[i] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[i] )); CPPUNIT_CHECK( ep.empty() ); } @@ -587,7 +587,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[0] ) == NULL ); + CPPUNIT_CHECK( l.get( a[0] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[0] ) ); CPPUNIT_CHECK( ep.empty() ); } @@ -604,7 +604,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->nKey == a[i] ); CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); @@ -616,7 +616,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( itm, other_less()) == NULL ); + CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, itm, other_less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -625,7 +625,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( other_item(0), other_less() ) == NULL ); + CPPUNIT_CHECK( l.get_with( other_item( 0 ), other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, other_item(0), other_less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -653,11 +653,11 @@ namespace ordlist { CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - CPPUNIT_ASSERT( l.find_with( v2.key(), less() ) == NULL ); + CPPUNIT_ASSERT( l.find_with( v2.key(), less() ) == nullptr ); CPPUNIT_ASSERT( !l.find_with( v3.key(), less(), find_functor() )); CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is not raised since pNext is NULL + CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is not raised since pNext is nullptr { value_type v( v1 ); diff --git a/tests/test-hdr/ordered_list/hdr_lazy.h b/tests/test-hdr/ordered_list/hdr_lazy.h index db8607e4..dfa95896 100644 --- a/tests/test-hdr/ordered_list/hdr_lazy.h +++ b/tests/test-hdr/ordered_list/hdr_lazy.h @@ -536,7 +536,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get( a[i] ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->nKey == a[i] ); CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); @@ -548,7 +548,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[i]) == NULL ); + CPPUNIT_CHECK( l.get( a[i] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[i] )); CPPUNIT_CHECK( ep.empty() ); } @@ -557,7 +557,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[0] ) == NULL ); + CPPUNIT_CHECK( l.get( a[0] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[0] ) ); CPPUNIT_CHECK( ep.empty() ); } @@ -572,7 +572,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->nKey == a[i] ); CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); @@ -584,7 +584,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( itm, other_less()) == NULL ); + CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, itm, other_less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -593,7 +593,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( other_item(0), other_less() ) == NULL ); + CPPUNIT_CHECK( l.get_with( other_item( 0 ), other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, other_item(0), other_less() )); CPPUNIT_CHECK( ep.empty() ); } diff --git a/tests/test-hdr/ordered_list/hdr_lazy_kv.h b/tests/test-hdr/ordered_list/hdr_lazy_kv.h index a542d802..5d9fdaa0 100644 --- a/tests/test-hdr/ordered_list/hdr_lazy_kv.h +++ b/tests/test-hdr/ordered_list/hdr_lazy_kv.h @@ -363,7 +363,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get( a[i] ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->first == a[i] ); CPPUNIT_CHECK( pGet->second.m_val == a[i] * 2 ); @@ -375,7 +375,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[i]) == NULL ); + CPPUNIT_CHECK( l.get( a[i] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[i] )); CPPUNIT_CHECK( ep.empty() ); } @@ -384,7 +384,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[0] ) == NULL ); + CPPUNIT_CHECK( l.get( a[0] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[0] ) ); CPPUNIT_CHECK( ep.empty() ); } @@ -399,7 +399,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->first == a[i] ); CPPUNIT_CHECK( pGet->second.m_val == a[i] * 2 ); @@ -411,7 +411,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( itm, other_less()) == NULL ); + CPPUNIT_CHECK( l.get_with( itm, other_less()) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, itm, other_less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -420,7 +420,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( 3.14f, other_less() ) == NULL ); + CPPUNIT_CHECK( l.get_with( 3.14f, other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, 3.14f, other_less() )); CPPUNIT_CHECK( ep.empty() ); } diff --git a/tests/test-hdr/ordered_list/hdr_michael.h b/tests/test-hdr/ordered_list/hdr_michael.h index 34e14f10..d77b7219 100644 --- a/tests/test-hdr/ordered_list/hdr_michael.h +++ b/tests/test-hdr/ordered_list/hdr_michael.h @@ -536,7 +536,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get( a[i] ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->nKey == a[i] ); CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); @@ -548,7 +548,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[i]) == NULL ); + CPPUNIT_CHECK( l.get( a[i] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[i] )); CPPUNIT_CHECK( ep.empty() ); } @@ -557,7 +557,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[0] ) == NULL ); + CPPUNIT_CHECK( l.get( a[0] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[0] ) ); CPPUNIT_CHECK( ep.empty() ); } @@ -572,7 +572,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->nKey == a[i] ); CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); @@ -584,7 +584,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( itm, other_less()) == NULL ); + CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, itm, other_less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -593,7 +593,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( other_item(0), other_less() ) == NULL ); + CPPUNIT_CHECK( l.get_with( other_item( 0 ), other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, other_item(0), other_less() )); CPPUNIT_CHECK( ep.empty() ); } diff --git a/tests/test-hdr/ordered_list/hdr_michael_kv.h b/tests/test-hdr/ordered_list/hdr_michael_kv.h index 09253fb7..8f701c79 100644 --- a/tests/test-hdr/ordered_list/hdr_michael_kv.h +++ b/tests/test-hdr/ordered_list/hdr_michael_kv.h @@ -373,7 +373,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get( a[i] ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->first == a[i] ); CPPUNIT_CHECK( pGet->second.m_val == a[i] * 2 ); @@ -385,7 +385,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[i]) == NULL ); + CPPUNIT_CHECK( l.get( a[i] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[i] )); CPPUNIT_CHECK( ep.empty() ); } @@ -394,7 +394,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get( a[0] ) == NULL ); + CPPUNIT_CHECK( l.get( a[0] ) == nullptr ); CPPUNIT_CHECK( !l.extract( ep, a[0] ) ); CPPUNIT_CHECK( ep.empty() ); } @@ -409,7 +409,7 @@ namespace ordlist { { rcu_lock lock; value_type * pGet = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( pGet != NULL ); + CPPUNIT_ASSERT( pGet != nullptr ); CPPUNIT_CHECK( pGet->first == a[i] ); CPPUNIT_CHECK( pGet->second.m_val == a[i] * 2 ); @@ -421,7 +421,7 @@ namespace ordlist { ep.release(); { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( itm, other_less()) == NULL ); + CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, itm, other_less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -430,7 +430,7 @@ namespace ordlist { { rcu_lock lock; - CPPUNIT_CHECK( l.get_with( 3.14f, other_less() ) == NULL ); + CPPUNIT_CHECK( l.get_with( 3.14f, other_less() ) == nullptr ); CPPUNIT_CHECK( !l.extract_with( ep, 3.14f, other_less() )); CPPUNIT_CHECK( ep.empty() ); } diff --git a/tests/test-hdr/priority_queue/hdr_intrusive_pqueue.h b/tests/test-hdr/priority_queue/hdr_intrusive_pqueue.h index 57f9e03d..70b86eb2 100644 --- a/tests/test-hdr/priority_queue/hdr_intrusive_pqueue.h +++ b/tests/test-hdr/priority_queue/hdr_intrusive_pqueue.h @@ -111,7 +111,7 @@ namespace priority_queue { // Pop test key_type nPrev = c_nMinValue + key_type(pq.capacity()) - 1; key_type * p = pq.pop(); - CPPUNIT_ASSERT( p != NULL ); + CPPUNIT_ASSERT( p != nullptr ); CPPUNIT_CHECK_EX( *p == nPrev, "Expected=" << nPrev << ", current=" << *p ); CPPUNIT_ASSERT( pq.size() == pq.capacity() - 1 ); @@ -121,7 +121,7 @@ namespace priority_queue { nSize = pq.size(); while ( pq.size() > 1 ) { p = pq.pop(); - CPPUNIT_ASSERT( p != NULL ); + CPPUNIT_ASSERT( p != nullptr ); CPPUNIT_CHECK_EX( *p == nPrev - 1, "Expected=" << nPrev - 1 << ", current=" << *p ); nPrev = *p; --nSize; @@ -133,7 +133,7 @@ namespace priority_queue { CPPUNIT_ASSERT( pq.size() == 1 ); p = pq.pop(); - CPPUNIT_ASSERT( p != NULL ); + CPPUNIT_ASSERT( p != nullptr ); CPPUNIT_CHECK_EX( *p == c_nMinValue, "Expected=" << c_nMinValue << ", current=" << *p ); CPPUNIT_ASSERT( !pq.full() ); diff --git a/tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp b/tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp index 0769363c..54d67d7f 100644 --- a/tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp +++ b/tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp @@ -69,7 +69,7 @@ namespace queue { value_type * pv; pv = q.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 1 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); @@ -77,7 +77,7 @@ namespace queue { CPPUNIT_CHECK( v3.nDisposeCount == 0 ); pv = q.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 2 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); @@ -85,7 +85,7 @@ namespace queue { CPPUNIT_CHECK( v3.nDisposeCount == 0 ); pv = q.dequeue(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 3 ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); @@ -93,7 +93,7 @@ namespace queue { CPPUNIT_CHECK( v3.nDisposeCount == 0 ); pv = q.dequeue(); - CPPUNIT_ASSERT( pv == NULL ); + CPPUNIT_ASSERT( pv == nullptr ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); CPPUNIT_CHECK( v2.nDisposeCount == 0 ); CPPUNIT_CHECK( v3.nDisposeCount == 0 ); diff --git a/tests/test-hdr/queue/hdr_intrusive_msqueue.h b/tests/test-hdr/queue/hdr_intrusive_msqueue.h index e040c7d2..2bac05fa 100644 --- a/tests/test-hdr/queue/hdr_intrusive_msqueue.h +++ b/tests/test-hdr/queue/hdr_intrusive_msqueue.h @@ -49,7 +49,7 @@ namespace queue { value_type * pv; pv = q.pop(); Queue::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 1 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); @@ -58,7 +58,7 @@ namespace queue { pv = q.pop(); Queue::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 2 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 1 ); @@ -67,7 +67,7 @@ namespace queue { pv = q.pop(); Queue::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 3 ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 1 ); @@ -75,7 +75,7 @@ namespace queue { CPPUNIT_CHECK( v3.nDisposeCount == 0 ); pv = q.pop(); - CPPUNIT_ASSERT( pv == NULL ); + CPPUNIT_ASSERT( pv == nullptr ); CPPUNIT_CHECK( v1.nDisposeCount == 1 ); CPPUNIT_CHECK( v2.nDisposeCount == 1 ); CPPUNIT_CHECK( v3.nDisposeCount == 0 ); @@ -119,7 +119,7 @@ namespace queue { value_type * pv; pv = q.pop(); Queue::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 1 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); @@ -129,7 +129,7 @@ namespace queue { pv = q.pop(); Queue::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 2 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); @@ -139,7 +139,7 @@ namespace queue { pv = q.pop(); Queue::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 3 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); @@ -149,7 +149,7 @@ namespace queue { pv = q.pop(); Queue::gc::scan(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 4 ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 1 ); @@ -159,7 +159,7 @@ namespace queue { pv = q.pop(); Queue::gc::scan(); - CPPUNIT_CHECK( pv == NULL ); + CPPUNIT_CHECK( pv == nullptr ); CPPUNIT_CHECK( v1.nDisposeCount == 1 ); CPPUNIT_CHECK( v2.nDisposeCount == 1 ); CPPUNIT_CHECK( v3.nDisposeCount == 1 ); @@ -198,7 +198,7 @@ namespace queue { value_type * pv; pv = q.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 1 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); @@ -206,7 +206,7 @@ namespace queue { CPPUNIT_CHECK( v3.nDisposeCount == 0 ); pv = q.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 2 ); CPPUNIT_ASSERT( !q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); @@ -214,7 +214,7 @@ namespace queue { CPPUNIT_CHECK( v3.nDisposeCount == 0 ); pv = q.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 3 ); CPPUNIT_ASSERT( q.empty() ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); @@ -222,7 +222,7 @@ namespace queue { CPPUNIT_CHECK( v3.nDisposeCount == 0 ); pv = q.pop(); - CPPUNIT_ASSERT( pv == NULL ); + CPPUNIT_ASSERT( pv == nullptr ); CPPUNIT_CHECK( v1.nDisposeCount == 0 ); CPPUNIT_CHECK( v2.nDisposeCount == 0 ); CPPUNIT_CHECK( v3.nDisposeCount == 0 ); diff --git a/tests/test-hdr/queue/hdr_intrusive_segmented_queue.h b/tests/test-hdr/queue/hdr_intrusive_segmented_queue.h index 53d3e5fe..2881b521 100644 --- a/tests/test-hdr/queue/hdr_intrusive_segmented_queue.h +++ b/tests/test-hdr/queue/hdr_intrusive_segmented_queue.h @@ -93,7 +93,7 @@ namespace queue { else pVal = q.dequeue(); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); int nSegment = int( nCount / q.quasi_factor() ); int nMin = nSegment * int(q.quasi_factor()); @@ -108,7 +108,7 @@ namespace queue { CPPUNIT_CHECK( misc::check_size( q, 0 )); // pop from empty queue - CPPUNIT_ASSERT( q.pop() == NULL ); + CPPUNIT_ASSERT( q.pop() == nullptr ); CPPUNIT_CHECK( q.empty() ); CPPUNIT_CHECK( misc::check_size( q, 0 )); diff --git a/tests/test-hdr/set/hdr_intrusive_cuckoo_set.h b/tests/test-hdr/set/hdr_intrusive_cuckoo_set.h index ba105d36..1738ae21 100644 --- a/tests/test-hdr/set/hdr_intrusive_cuckoo_set.h +++ b/tests/test-hdr/set/hdr_intrusive_cuckoo_set.h @@ -393,11 +393,11 @@ namespace set { CPPUNIT_ASSERT( s.unlink( e1 ) ); CPPUNIT_ASSERT( s.erase_with( k2, typename std::conditional::type() ) == &e2 ); - CPPUNIT_ASSERT( s.erase( e2 ) == NULL ); + CPPUNIT_ASSERT( s.erase( e2 ) == nullptr ); CPPUNIT_ASSERT( e3.nEraseCount == 0 ); CPPUNIT_ASSERT( s.erase_with( k3, typename std::conditional::type(), erase_functor()) == &e3 ); CPPUNIT_ASSERT( e3.nEraseCount == 1 ); - CPPUNIT_ASSERT( s.erase( k3, erase_functor()) == NULL ); + CPPUNIT_ASSERT( s.erase( k3, erase_functor() ) == nullptr ); CPPUNIT_ASSERT( e3.nEraseCount == 1 ); CPPUNIT_ASSERT( s.insert( e3 ) ); diff --git a/tests/test-hdr/set/hdr_intrusive_set.h b/tests/test-hdr/set/hdr_intrusive_set.h index 12ca4ea8..33f36a22 100644 --- a/tests/test-hdr/set/hdr_intrusive_set.h +++ b/tests/test-hdr/set/hdr_intrusive_set.h @@ -610,13 +610,13 @@ namespace set { CPPUNIT_ASSERT( check_size( s, 0 )); // insert/find test - CPPUNIT_ASSERT( s.find( v1.key() ) == NULL ); + CPPUNIT_ASSERT( s.find( v1.key() ) == nullptr ); CPPUNIT_ASSERT( s.insert( v1 )); CPPUNIT_ASSERT( s.find_with( v1.key(), less() ) == &v1 ); CPPUNIT_ASSERT( check_size( s, 1 )); CPPUNIT_ASSERT( !s.empty() ); - CPPUNIT_ASSERT( s.find( v2.key() ) == NULL ); + CPPUNIT_ASSERT( s.find( v2.key() ) == nullptr ); CPPUNIT_ASSERT( s.insert( v2 )); CPPUNIT_ASSERT( v2.nFindCount == 0 ); CPPUNIT_ASSERT( s.find( key = v2.key(), find_functor() )); @@ -627,7 +627,7 @@ namespace set { { find_functor ff; - CPPUNIT_ASSERT( s.find( v3 ) == NULL ); + CPPUNIT_ASSERT( s.find( v3 ) == nullptr ); CPPUNIT_ASSERT( s.insert( v3 )); CPPUNIT_ASSERT( v3.nFindCount == 0 ); CPPUNIT_ASSERT( s.find_with( v3, less(), cds::ref(ff) )); @@ -1002,7 +1002,7 @@ namespace set { { rcu_lock l; pVal = s.get( nKey ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == nKey ); CPPUNIT_CHECK( pVal->nVal == nKey * 2 ); @@ -1014,13 +1014,13 @@ namespace set { ep.release(); { rcu_lock l; - CPPUNIT_CHECK( s.get( nKey ) == NULL ); + CPPUNIT_CHECK( s.get( nKey ) == nullptr ); CPPUNIT_CHECK( !s.extract( ep, nKey )); CPPUNIT_CHECK( ep.empty() ); nKey = arr[i+1]; pVal = s.get_with( nKey, less() ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == nKey ); CPPUNIT_CHECK( pVal->nVal == nKey * 2 ); @@ -1032,7 +1032,7 @@ namespace set { ep.release(); { rcu_lock l; - CPPUNIT_CHECK( s.get_with( nKey, less() ) == NULL ); + CPPUNIT_CHECK( s.get_with( nKey, less() ) == nullptr ); CPPUNIT_CHECK( !s.extract_with( ep, nKey, less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -1041,7 +1041,7 @@ namespace set { CPPUNIT_CHECK( check_size( s, 0 )); { rcu_lock l; - CPPUNIT_CHECK( s.get( 100 ) == NULL ); + CPPUNIT_CHECK( s.get( 100 ) == nullptr ); CPPUNIT_CHECK( !s.extract( ep, 100 )); CPPUNIT_CHECK( ep.empty() ); } diff --git a/tests/test-hdr/set/hdr_intrusive_skiplist_set.h b/tests/test-hdr/set/hdr_intrusive_skiplist_set.h index 0b43a741..b7be0510 100644 --- a/tests/test-hdr/set/hdr_intrusive_skiplist_set.h +++ b/tests/test-hdr/set/hdr_intrusive_skiplist_set.h @@ -310,7 +310,7 @@ namespace set { Set::gc::force_dispose(); } - CPPUNIT_MSG( PrintStat()( s, NULL )); + CPPUNIT_MSG( PrintStat()(s, nullptr) ); } template @@ -350,13 +350,13 @@ namespace set { CPPUNIT_ASSERT( check_size( s, 0 )); // insert/find test - CPPUNIT_ASSERT( s.find( v1.key() ) == NULL ); + CPPUNIT_ASSERT( s.find( v1.key() ) == nullptr ); CPPUNIT_ASSERT( s.insert( v1 )); CPPUNIT_ASSERT( s.find( v1.key() ) == &v1 ); CPPUNIT_ASSERT( check_size( s, 1 )); CPPUNIT_ASSERT( !s.empty() ); - CPPUNIT_ASSERT( s.find_with( v2.key(), less() ) == NULL ); + CPPUNIT_ASSERT( s.find_with( v2.key(), less() ) == nullptr ); CPPUNIT_ASSERT( s.insert( v2 )); CPPUNIT_ASSERT( v2.nFindCount == 0 ); CPPUNIT_ASSERT( s.find_with( key = v2.key(), less(), find_functor() )); @@ -367,7 +367,7 @@ namespace set { { find_functor ff; - CPPUNIT_ASSERT( s.find( v3 ) == NULL ); + CPPUNIT_ASSERT( s.find( v3 ) == nullptr ); CPPUNIT_ASSERT( s.insert( v3 )); CPPUNIT_ASSERT( v3.nFindCount == 0 ); CPPUNIT_ASSERT( s.find( v3, cds::ref(ff) )); @@ -442,8 +442,8 @@ namespace set { //CPPUNIT_MSG( PrintStat()(s, "Ensure test") ); // get_min test - CPPUNIT_CHECK( s.get_min() == NULL ); - CPPUNIT_CHECK( s.get_max() == NULL ); + CPPUNIT_CHECK( s.get_min() == nullptr ); + CPPUNIT_CHECK( s.get_max() == nullptr ); { value_type v[1000]; @@ -453,7 +453,7 @@ namespace set { CPPUNIT_ASSERT( s.insert( v[i] )); value_type * pVal = s.get_min(); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == i ); CPPUNIT_CHECK( pVal->nVal == i * 2 ); } @@ -475,7 +475,7 @@ namespace set { CPPUNIT_ASSERT( s.insert( v[i] )); value_type * pVal = s.get_max(); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == i ); CPPUNIT_CHECK( pVal->nVal == i * 2 ); } @@ -507,7 +507,7 @@ namespace set { CPPUNIT_ASSERT( s.begin() == s.end() ); CPPUNIT_ASSERT( s.cbegin() == s.cend() ); - CPPUNIT_MSG( PrintStat()(s, NULL) ); + CPPUNIT_MSG( PrintStat()(s, nullptr) ); } public: diff --git a/tests/test-hdr/set/hdr_intrusive_skiplist_set_rcu.h b/tests/test-hdr/set/hdr_intrusive_skiplist_set_rcu.h index bc65e86c..973cea29 100644 --- a/tests/test-hdr/set/hdr_intrusive_skiplist_set_rcu.h +++ b/tests/test-hdr/set/hdr_intrusive_skiplist_set_rcu.h @@ -262,7 +262,7 @@ namespace set { { rcu_lock l; pVal = s.get( i ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == i ); CPPUNIT_CHECK( pVal->nVal == i * 2 ); pVal->nVal *= 2; @@ -276,7 +276,7 @@ namespace set { { rcu_lock l; - CPPUNIT_CHECK( s.get( i ) == NULL ); + CPPUNIT_CHECK( s.get( i ) == nullptr ); } CPPUNIT_CHECK( !s.extract( ep, i ) ); CPPUNIT_ASSERT( ep.empty() ); @@ -292,7 +292,7 @@ namespace set { { rcu_lock l; value_type * pVal = s.get_with( other_key(i), other_key_less() ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == i ); CPPUNIT_CHECK( pVal->nVal == i * 2 ); pVal->nVal *= 2; @@ -306,7 +306,7 @@ namespace set { { rcu_lock l; - CPPUNIT_CHECK( s.get_with( other_key(i), other_key_less() ) == NULL ); + CPPUNIT_CHECK( s.get_with( other_key( i ), other_key_less() ) == nullptr ); } CPPUNIT_CHECK( !s.extract_with( ep, other_key(i), other_key_less() )); } @@ -361,7 +361,7 @@ namespace set { CPPUNIT_CHECK( !s.extract_max(ep) ); } - CPPUNIT_MSG( PrintStat()(s, NULL) ); + CPPUNIT_MSG( PrintStat()(s, nullptr) ); } template diff --git a/tests/test-hdr/set/hdr_intrusive_striped_set.h b/tests/test-hdr/set/hdr_intrusive_striped_set.h index b6e36e79..42abe4fa 100644 --- a/tests/test-hdr/set/hdr_intrusive_striped_set.h +++ b/tests/test-hdr/set/hdr_intrusive_striped_set.h @@ -369,11 +369,11 @@ namespace set { CPPUNIT_ASSERT( s.unlink( e1 ) ); CPPUNIT_ASSERT( s.erase_with( k2, less2() ) == &e2 ); - CPPUNIT_ASSERT( s.erase( e2 ) == NULL ); + CPPUNIT_ASSERT( s.erase( e2 ) == nullptr ); CPPUNIT_ASSERT( e3.nEraseCount == 0 ); CPPUNIT_ASSERT( s.erase_with( k3, less2(), erase_functor()) == &e3 ); CPPUNIT_ASSERT( e3.nEraseCount == 1 ); - CPPUNIT_ASSERT( s.erase( k3, erase_functor()) == NULL ); + CPPUNIT_ASSERT( s.erase( k3, erase_functor() ) == nullptr ); CPPUNIT_ASSERT( e3.nEraseCount == 1 ); CPPUNIT_ASSERT( s.insert( e3 ) ); diff --git a/tests/test-hdr/set/hdr_set.h b/tests/test-hdr/set/hdr_set.h index b449613e..fc1e2ed2 100644 --- a/tests/test-hdr/set/hdr_set.h +++ b/tests/test-hdr/set/hdr_set.h @@ -436,7 +436,7 @@ namespace set { { rcu_lock l; pVal = s.get( nKey ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == nKey ); CPPUNIT_CHECK( pVal->nVal == nKey ); @@ -448,13 +448,13 @@ namespace set { ep.release(); { rcu_lock l; - CPPUNIT_CHECK( s.get( nKey ) == NULL ); + CPPUNIT_CHECK( s.get( nKey ) == nullptr ); CPPUNIT_CHECK( !s.extract( ep, nKey )); CPPUNIT_CHECK( ep.empty() ); nKey = arr[i+1]; pVal = s.get_with( other_item(nKey), other_less() ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == nKey ); CPPUNIT_CHECK( pVal->nVal == nKey ); @@ -466,7 +466,7 @@ namespace set { ep.release(); { rcu_lock l; - CPPUNIT_CHECK( s.get_with( other_item(nKey), other_less() ) == NULL ); + CPPUNIT_CHECK( s.get_with( other_item( nKey ), other_less() ) == nullptr ); CPPUNIT_CHECK( !s.extract_with( ep, other_item(nKey), other_less() )); CPPUNIT_CHECK( ep.empty() ); } @@ -475,7 +475,7 @@ namespace set { CPPUNIT_CHECK( check_size( s, 0 )); { rcu_lock l; - CPPUNIT_CHECK( s.get( int(nLimit / 2) ) == NULL ); + CPPUNIT_CHECK( s.get( int( nLimit / 2 ) ) == nullptr ); CPPUNIT_CHECK( !s.extract( ep, int(nLimit / 2) )); CPPUNIT_CHECK( ep.empty() ); } diff --git a/tests/test-hdr/set/hdr_skiplist_set.h b/tests/test-hdr/set/hdr_skiplist_set.h index fb069435..706e3c8d 100644 --- a/tests/test-hdr/set/hdr_skiplist_set.h +++ b/tests/test-hdr/set/hdr_skiplist_set.h @@ -245,7 +245,7 @@ namespace set { CPPUNIT_ASSERT( gp.empty() ); } - CPPUNIT_MSG( PrintStat()(s, NULL) ); + CPPUNIT_MSG( PrintStat()(s, nullptr) ); } template @@ -372,7 +372,7 @@ namespace set { CPPUNIT_ASSERT( s.insert( std::make_pair( i, i * 2) ) != s.end() ); typename Set::value_type * pVal = s.get_min(); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == i ); CPPUNIT_CHECK( pVal->nVal == i * 2 ); } @@ -381,15 +381,15 @@ namespace set { CPPUNIT_ASSERT( s.empty() ); CPPUNIT_ASSERT( check_size( s, 0 )); - CPPUNIT_CHECK( s.get_min() == NULL ); - CPPUNIT_CHECK( s.get_max() == NULL ); + CPPUNIT_CHECK( s.get_min() == nullptr ); + CPPUNIT_CHECK( s.get_max() == nullptr ); // iterator test for ( int i = 0; i < 500; ++i ) { CPPUNIT_ASSERT( s.insert( std::make_pair( i, i * 2) ) != s.end() ); typename Set::value_type * pVal = s.get_max(); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == i ); CPPUNIT_CHECK( pVal->nVal == i * 2 ); } diff --git a/tests/test-hdr/set/hdr_skiplist_set_rcu.h b/tests/test-hdr/set/hdr_skiplist_set_rcu.h index f210d8b2..ff99ebdb 100644 --- a/tests/test-hdr/set/hdr_skiplist_set_rcu.h +++ b/tests/test-hdr/set/hdr_skiplist_set_rcu.h @@ -163,7 +163,7 @@ namespace set { { rcu_lock l; pVal = s.get( nKey ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == nKey ); CPPUNIT_CHECK( pVal->nVal == nKey * 2 ); } @@ -176,7 +176,7 @@ namespace set { { rcu_lock l; - CPPUNIT_CHECK( s.get( nKey ) == NULL ); + CPPUNIT_CHECK( s.get( nKey ) == nullptr ); } CPPUNIT_CHECK( !s.extract( ep, nKey )); } @@ -191,7 +191,7 @@ namespace set { { rcu_lock l; pVal = s.get_with( wrapped_item(nKey), wrapped_less() ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == nKey ); CPPUNIT_CHECK( pVal->nVal == nKey ); } @@ -204,7 +204,7 @@ namespace set { { rcu_lock l; - CPPUNIT_CHECK( s.get_with( wrapped_item(nKey), wrapped_less() ) == NULL ); + CPPUNIT_CHECK( s.get_with( wrapped_item( nKey ), wrapped_less() ) == nullptr ); } CPPUNIT_CHECK( !s.extract_with( ep, wrapped_item(nKey), wrapped_less() )); } @@ -241,7 +241,7 @@ namespace set { CPPUNIT_CHECK( !s.extract_max(ep) ); } - CPPUNIT_MSG( PrintStat()(s, NULL) ); + CPPUNIT_MSG( PrintStat()(s, nullptr) ); } public: diff --git a/tests/test-hdr/stack/hdr_intrusive_fcstack.cpp b/tests/test-hdr/stack/hdr_intrusive_fcstack.cpp index ebc2d248..c7bc6cd8 100644 --- a/tests/test-hdr/stack/hdr_intrusive_fcstack.cpp +++ b/tests/test-hdr/stack/hdr_intrusive_fcstack.cpp @@ -69,19 +69,19 @@ namespace stack { value_type * pv; pv = stack.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 3 ); CPPUNIT_ASSERT( !stack.empty() ); pv = stack.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 2 ); CPPUNIT_ASSERT( !stack.empty() ); pv = stack.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 1 ); CPPUNIT_ASSERT( stack.empty() ); pv = stack.pop(); - CPPUNIT_ASSERT( pv == NULL ); + CPPUNIT_ASSERT( pv == nullptr ); CPPUNIT_ASSERT( v1.nDisposeCount == 0 ); CPPUNIT_ASSERT( v2.nDisposeCount == 0 ); diff --git a/tests/test-hdr/stack/hdr_intrusive_treiber_stack.h b/tests/test-hdr/stack/hdr_intrusive_treiber_stack.h index 6749e3f1..41077a08 100644 --- a/tests/test-hdr/stack/hdr_intrusive_treiber_stack.h +++ b/tests/test-hdr/stack/hdr_intrusive_treiber_stack.h @@ -77,19 +77,19 @@ namespace stack { value_type * pv; pv = stack.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 3 ); CPPUNIT_ASSERT( !stack.empty() ); pv = stack.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 2 ); CPPUNIT_ASSERT( !stack.empty() ); pv = stack.pop(); - CPPUNIT_ASSERT( pv != NULL ); + CPPUNIT_ASSERT( pv != nullptr ); CPPUNIT_ASSERT( pv->nVal == 1 ); CPPUNIT_ASSERT( stack.empty() ); pv = stack.pop(); - CPPUNIT_ASSERT( pv == NULL ); + CPPUNIT_ASSERT( pv == nullptr ); CPPUNIT_ASSERT( v1.nDisposeCount == 0 ); CPPUNIT_ASSERT( v2.nDisposeCount == 0 ); diff --git a/tests/test-hdr/tree/hdr_ellenbintree_map.h b/tests/test-hdr/tree/hdr_ellenbintree_map.h index c122746d..da48bcd5 100644 --- a/tests/test-hdr/tree/hdr_ellenbintree_map.h +++ b/tests/test-hdr/tree/hdr_ellenbintree_map.h @@ -511,7 +511,7 @@ namespace tree { { typename map_type::rcu_lock l; typename map_type::value_type * pVal = m.get(nKey); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->first == nKey); } CPPUNIT_ASSERT( m.extract( ep, nKey )); @@ -535,7 +535,7 @@ namespace tree { { typename map_type::rcu_lock l; typename map_type::value_type * pVal = m.get_with(wrapped_int(nKey), wrapped_less()); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->first == nKey); } CPPUNIT_ASSERT( m.extract_with( ep, wrapped_int(nKey), wrapped_less() )); diff --git a/tests/test-hdr/tree/hdr_ellenbintree_set.h b/tests/test-hdr/tree/hdr_ellenbintree_set.h index 08e4f929..b8726e9d 100644 --- a/tests/test-hdr/tree/hdr_ellenbintree_set.h +++ b/tests/test-hdr/tree/hdr_ellenbintree_set.h @@ -609,7 +609,7 @@ namespace tree { { typename set_type::rcu_lock l; value_type * p = s.get( nKey ); - CPPUNIT_ASSERT( p != NULL ); + CPPUNIT_ASSERT( p != nullptr ); CPPUNIT_CHECK( p->nKey == nKey ); } CPPUNIT_ASSERT( s.extract( ep, nKey )); @@ -619,7 +619,7 @@ namespace tree { { typename set_type::rcu_lock l; - CPPUNIT_CHECK( s.get( nKey ) == NULL ); + CPPUNIT_CHECK( s.get( nKey ) == nullptr ); } CPPUNIT_CHECK( !s.extract( ep, nKey )); } @@ -632,7 +632,7 @@ namespace tree { { typename set_type::rcu_lock l; value_type * p = s.get_with( wrapped_int(nKey), wrapped_less() ); - CPPUNIT_ASSERT( p != NULL ); + CPPUNIT_ASSERT( p != nullptr ); CPPUNIT_CHECK( p->nKey == nKey ); } CPPUNIT_ASSERT( s.extract_with( ep, wrapped_int(nKey), wrapped_less() )); @@ -642,7 +642,7 @@ namespace tree { { typename set_type::rcu_lock l; - CPPUNIT_CHECK( s.get_with( wrapped_int(nKey), wrapped_less() ) == NULL ); + CPPUNIT_CHECK( s.get_with( wrapped_int( nKey ), wrapped_less() ) == nullptr ); } CPPUNIT_CHECK( !s.extract_with( ep, wrapped_int(nKey), wrapped_less() )); } diff --git a/tests/test-hdr/tree/hdr_intrusive_bintree.h b/tests/test-hdr/tree/hdr_intrusive_bintree.h index 741be4fb..67e56f9b 100644 --- a/tests/test-hdr/tree/hdr_intrusive_bintree.h +++ b/tests/test-hdr/tree/hdr_intrusive_bintree.h @@ -842,7 +842,7 @@ namespace tree { { typename tree_type::rcu_lock l; pVal = t.get( v1.nKey ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal == &v1 ); } CPPUNIT_ASSERT( t.extract( ep, v1.nKey )); @@ -850,7 +850,7 @@ namespace tree { CPPUNIT_CHECK( ep->nKey == v1.nKey ); { typename tree_type::rcu_lock l; - CPPUNIT_CHECK( t.get( v1.nKey ) == NULL ); + CPPUNIT_CHECK( t.get( v1.nKey ) == nullptr ); } ep.release(); CPPUNIT_ASSERT( !t.extract( ep, v1.nKey )); @@ -859,7 +859,7 @@ namespace tree { CPPUNIT_CHECK( ep->nKey == v5.nKey ); { typename tree_type::rcu_lock l; - CPPUNIT_CHECK( t.get( v5.nKey ) == NULL ); + CPPUNIT_CHECK( t.get( v5.nKey ) == nullptr ); } ep.release(); CPPUNIT_ASSERT( !t.extract( ep, v5.nKey )); @@ -868,14 +868,14 @@ namespace tree { CPPUNIT_CHECK( ep->nKey == v3.nKey ); { typename tree_type::rcu_lock l; - CPPUNIT_CHECK( t.get( v3.nKey ) == NULL ); + CPPUNIT_CHECK( t.get( v3.nKey ) == nullptr ); } ep.release(); { typename tree_type::rcu_lock l; pVal = t.get_with( wrapped_int(v2.nKey), wrapped_less() ); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal == &v2 ); } CPPUNIT_ASSERT( t.extract_with( ep, wrapped_int(v2.nKey), wrapped_less() )); @@ -883,7 +883,7 @@ namespace tree { CPPUNIT_CHECK( ep->nKey == v2.nKey ); { typename tree_type::rcu_lock l; - CPPUNIT_CHECK( t.get_with( wrapped_int(v2.nKey), wrapped_less() ) == NULL ); + CPPUNIT_CHECK( t.get_with( wrapped_int( v2.nKey ), wrapped_less() ) == nullptr ); } ep.release(); CPPUNIT_CHECK( !t.extract_with( ep, wrapped_int(v2.nKey), wrapped_less() )); @@ -901,11 +901,11 @@ namespace tree { { typename tree_type::rcu_lock l; - CPPUNIT_CHECK( t.get( v1.nKey ) == NULL ); - CPPUNIT_CHECK( t.get( v2.nKey ) == NULL ); - CPPUNIT_CHECK( t.get( v3.nKey ) == NULL ); - CPPUNIT_CHECK( t.get( v4.nKey ) == NULL ); - CPPUNIT_CHECK( t.get( v5.nKey ) == NULL ); + CPPUNIT_CHECK( t.get( v1.nKey ) == nullptr ); + CPPUNIT_CHECK( t.get( v2.nKey ) == nullptr ); + CPPUNIT_CHECK( t.get( v3.nKey ) == nullptr ); + CPPUNIT_CHECK( t.get( v4.nKey ) == nullptr ); + CPPUNIT_CHECK( t.get( v5.nKey ) == nullptr ); } CPPUNIT_CHECK( !t.extract(ep, v1.nKey)); diff --git a/tests/unit/alloc/hoard_threadtest.cpp b/tests/unit/alloc/hoard_threadtest.cpp index c931a5b1..df2f807c 100644 --- a/tests/unit/alloc/hoard_threadtest.cpp +++ b/tests/unit/alloc/hoard_threadtest.cpp @@ -76,8 +76,8 @@ namespace memory { for ( size_t nPass = 0; nPass < s_nPassPerThread; ++nPass ) { value_type ** pCell = m_arr; for ( size_t i = 0; i < s_nBlockCount; ++i, ++pCell ) { - *pCell = m_Alloc.allocate( nSize, NULL ); - CPPUNIT_ASSERT( *pCell != NULL ); + *pCell = m_Alloc.allocate( nSize, nullptr ); + CPPUNIT_ASSERT( *pCell != nullptr ); if ( nSize < 32 ) memset( *pCell, 0, nSize ); diff --git a/tests/unit/alloc/larson.cpp b/tests/unit/alloc/larson.cpp index f09de31c..92388f54 100644 --- a/tests/unit/alloc/larson.cpp +++ b/tests/unit/alloc/larson.cpp @@ -80,7 +80,7 @@ namespace memory { for ( size_t nPass = 0; nPass < s_nPassPerThread; ++nPass ) { size_t nItem = m_rndGen( size_t(1), s_nBlocksPerThread ) - 1; m_Alloc.deallocate( reinterpret_cast(m_arr[nItem]), 1 ); - m_arr[nItem] = reinterpret_cast( m_Alloc.allocate( m_rndGen(s_nMinBlockSize, s_nMaxBlockSize), NULL )); + m_arr[nItem] = reinterpret_cast(m_Alloc.allocate( m_rndGen( s_nMinBlockSize, s_nMaxBlockSize ), nullptr )); CPPUNIT_ASSERT( (reinterpret_cast(m_arr[nItem]) & (ALLOC::alignment - 1)) == 0 ); } } @@ -105,7 +105,7 @@ namespace memory { = m_aThreadData[nThread] = new char *[ s_nBlocksPerThread ]; for ( size_t i = 0; i < s_nBlocksPerThread; ++i ) { - thData[i] = reinterpret_cast( alloc.allocate( rndGen(s_nMinBlockSize, s_nMaxBlockSize), NULL )); + thData[i] = reinterpret_cast(alloc.allocate( rndGen( s_nMinBlockSize, s_nMaxBlockSize ), nullptr )); CPPUNIT_ASSERT( (reinterpret_cast(thData[i]) & (ALLOC::alignment - 1)) == 0 ); } } diff --git a/tests/unit/alloc/linux_scale.cpp b/tests/unit/alloc/linux_scale.cpp index a09d5a91..bf05807b 100644 --- a/tests/unit/alloc/linux_scale.cpp +++ b/tests/unit/alloc/linux_scale.cpp @@ -57,8 +57,8 @@ namespace memory { virtual void test() { for ( size_t i = 0; i < s_nPassPerThread; ++i ) { - typename ALLOC::value_type * p = m_Alloc.allocate( m_nSize / sizeof(typename ALLOC::value_type), NULL ); - CPPUNIT_ASSERT( p != NULL ); + typename ALLOC::value_type * p = m_Alloc.allocate( m_nSize / sizeof( typename ALLOC::value_type ), nullptr ); + CPPUNIT_ASSERT( p != nullptr ); if ( m_nSize < 32 ) memset( p, 0, m_nSize ); else { diff --git a/tests/unit/alloc/random.cpp b/tests/unit/alloc/random.cpp index dca2b100..05034f8e 100644 --- a/tests/unit/alloc/random.cpp +++ b/tests/unit/alloc/random.cpp @@ -27,7 +27,7 @@ namespace memory { Item() : m_access( false ) - , m_pszBlock( NULL ) + , m_pszBlock( nullptr ) {} Item& operator =(Item const& i) @@ -85,11 +85,11 @@ namespace memory { if ( item.m_access.tryLock() ) { if ( item.m_pszBlock ) { m_Alloc.deallocate( item.m_pszBlock, 1 ); - item.m_pszBlock = NULL; + item.m_pszBlock = nullptr; } else { size_t nSize; - item.m_pszBlock = m_Alloc.allocate( nSize = m_rndGen(s_nMinBlockSize, s_nMaxBlockSize ), NULL ); + item.m_pszBlock = m_Alloc.allocate( nSize = m_rndGen( s_nMinBlockSize, s_nMaxBlockSize ), nullptr ); if ( nSize < 32 ) memset( item.m_pszBlock, 0, nSize ); @@ -124,7 +124,7 @@ namespace memory { for ( size_t i = 0; i < m_Data.size(); ++i ) { if ( m_Data[i].m_pszBlock ) { alloc.deallocate( m_Data[i].m_pszBlock, 1 ); - m_Data[i].m_pszBlock = NULL; + m_Data[i].m_pszBlock = nullptr; } } } diff --git a/tests/unit/ellen_bintree_update_desc_pool.h b/tests/unit/ellen_bintree_update_desc_pool.h index d88f60c3..ccb37f23 100644 --- a/tests/unit/ellen_bintree_update_desc_pool.h +++ b/tests/unit/ellen_bintree_update_desc_pool.h @@ -83,7 +83,7 @@ namespace ellen_bintree_pool { typedef internal_node_allocator< Other, Alloc > other; }; - T * allocate( size_t n, void const * pHint = NULL ) + T * allocate( size_t n, void const * pHint = nullptr ) { internal_node_counter::onAlloc(); return base_class::allocate( n, pHint ); diff --git a/tests/unit/lock/win32_lock.h b/tests/unit/lock/win32_lock.h index d9f15118..197c67cc 100644 --- a/tests/unit/lock/win32_lock.h +++ b/tests/unit/lock/win32_lock.h @@ -27,7 +27,7 @@ namespace lock { HANDLE m_hMutex; public: - Mutex() { m_hMutex = ::CreateMutex( NULL, false, NULL ) ; } + Mutex() { m_hMutex = ::CreateMutex( nullptr, false, nullptr ); } ~Mutex() { ::CloseHandle( m_hMutex ) ; } void lock() { ::WaitForSingleObject( m_hMutex, INFINITE ); } diff --git a/tests/unit/michael_alloc.h b/tests/unit/michael_alloc.h index a03a94de..0a4168f1 100644 --- a/tests/unit/michael_alloc.h +++ b/tests/unit/michael_alloc.h @@ -28,7 +28,7 @@ namespace memory { typedef typename std_allocator::value_type value_type; // Allocation function - pointer allocate( size_type _Count, const void* _Hint = NULL ) + pointer allocate( size_type _Count, const void* _Hint = nullptr ) { return reinterpret_cast( s_MichaelHeap.alloc( sizeof(T) * _Count )); } diff --git a/tests/unit/queue/intrusive_queue_reader_writer.cpp b/tests/unit/queue/intrusive_queue_reader_writer.cpp index 8f3c8f6e..01cf3936 100644 --- a/tests/unit/queue/intrusive_queue_reader_writer.cpp +++ b/tests/unit/queue/intrusive_queue_reader_writer.cpp @@ -248,7 +248,7 @@ namespace queue { } else { Writer * pWriter = dynamic_cast( *it ); - CPPUNIT_ASSERT( pWriter != NULL ); + CPPUNIT_ASSERT( pWriter != nullptr ); fTimeWriter += pWriter->m_fTime; nPushFailed += pWriter->m_nPushFailed; if ( !boost::is_base_of::value ) { diff --git a/tests/unit/queue/intrusive_queue_type.h b/tests/unit/queue/intrusive_queue_type.h index 23e9f08b..7e9f65ac 100644 --- a/tests/unit/queue/intrusive_queue_type.h +++ b/tests/unit/queue/intrusive_queue_type.h @@ -120,7 +120,7 @@ namespace queue { { lock_guard l( m_Lock ); if ( m_List.empty() ) - return cds::nullptr; + return nullptr; value_type& v = m_List.front(); m_List.pop_front(); return &v; diff --git a/tests/unit/queue/queue_reader_writer.cpp b/tests/unit/queue/queue_reader_writer.cpp index 2b9511fb..ea36000a 100644 --- a/tests/unit/queue/queue_reader_writer.cpp +++ b/tests/unit/queue/queue_reader_writer.cpp @@ -222,7 +222,7 @@ namespace queue { } else { Writer * pWriter = dynamic_cast( *it ); - CPPUNIT_ASSERT( pWriter != NULL ); + CPPUNIT_ASSERT( pWriter != nullptr ); fTimeWriter += pWriter->m_fTime; nPushFailed += pWriter->m_nPushFailed; if ( !boost::is_base_of::value ) { diff --git a/tests/unit/set2/set_insdelfind.cpp b/tests/unit/set2/set_insdelfind.cpp index 05f3bffa..88a18999 100644 --- a/tests/unit/set2/set_insdelfind.cpp +++ b/tests/unit/set2/set_insdelfind.cpp @@ -160,7 +160,7 @@ namespace set2 { size_t nFindFailed = 0; for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) { work_thread * pThread = static_cast( *it ); - assert( pThread != NULL ); + assert( pThread != nullptr ); nInsertSuccess += pThread->m_nInsertSuccess; nInsertFailed += pThread->m_nInsertFailed; nDeleteSuccess += pThread->m_nDeleteSuccess; diff --git a/tests/unit/stack/intrusive_stack_type.h b/tests/unit/stack/intrusive_stack_type.h index 14e40f64..008c9d12 100644 --- a/tests/unit/stack/intrusive_stack_type.h +++ b/tests/unit/stack/intrusive_stack_type.h @@ -88,7 +88,7 @@ namespace istack { m_Impl.pop(); return v; } - return NULL; + return nullptr; } bool empty() const