From ec21450522e3c2124f3510eef5cfd88420483248 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Thu, 26 Jun 2014 18:18:01 -0700 Subject: Low hanging fruit --- src/compat/iter_test.cpp | 5 ++++- src/compat/nullpo.hpp | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/compat') diff --git a/src/compat/iter_test.cpp b/src/compat/iter_test.cpp index b9bfb6a..f0e6031 100644 --- a/src/compat/iter_test.cpp +++ b/src/compat/iter_test.cpp @@ -26,6 +26,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + TEST(iterpair, strings) { IteratorPair> pair = value_range('0', ':'); @@ -144,7 +147,7 @@ TEST(iterpair, filter3) int one = 1; int two = 2; int three = 3; - std::vector vals = {0, &one, 0, &two, 0, &three, 0}; + std::vector vals = {nullptr, &one, nullptr, &two, nullptr, &three, nullptr}; int sum = 0, count = 0; for (int *i : filter_iterator(&vals)) diff --git a/src/compat/nullpo.hpp b/src/compat/nullpo.hpp index d6e39a5..5de8ab6 100644 --- a/src/compat/nullpo.hpp +++ b/src/compat/nullpo.hpp @@ -26,7 +26,8 @@ //# define BUG_FREE /// All functions print to standard error (was: standard output) -/// nullpo_ret(cond) - return 0 if given pointer is NULL +/// nullpo_retn(cond) - return nullptr if given pointer is nullptr +/// nullpo_retz(cond) - return 0 if given pointer is nullptr /// nullpo_retv(cond) - just return (function returns void) /// nullpo_retr(rv, cond) - return given value instead @@ -38,7 +39,8 @@ # define nullpo_retr(ret, t) /*t*/ # endif // BUG_FREE -# define nullpo_ret(t) nullpo_retr(0, t) +# define nullpo_retn(t) nullpo_retr(nullptr, t) +# define nullpo_retz(t) nullpo_retr(0, t) # define nullpo_retv(t) nullpo_retr(, t) # include "fwd.hpp" -- cgit v1.2.3-60-g2f50