From 32a191ce4bfb75765e9d5d5117d6fd6882c453d4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 20 Nov 2014 10:19:17 -0500 Subject: [PATCH] cmTarget: Use null_ptr code path on all platforms This reduces conversions asked of the compiler. Also drop 'static' from the declaration of the local null_ptr helper. --- Source/cmTarget.cxx | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ee62f0606..4a5cc64e6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4798,11 +4798,7 @@ std::pair consistentNumberProperty(const char *lhs, { char *pEnd; -#if defined(_MSC_VER) - static const char* const null_ptr = 0; -#else -# define null_ptr 0 -#endif + const char* const null_ptr = 0; long lnum = strtol(lhs, &pEnd, 0); if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) @@ -4816,10 +4812,6 @@ std::pair consistentNumberProperty(const char *lhs, return std::pair(false, null_ptr); } -#if !defined(_MSC_VER) -#undef null_ptr -#endif - if (t == NumberMaxType) { return std::make_pair(true, cmMaximum(lnum, rnum) == lnum ? lhs : rhs); @@ -4849,11 +4841,7 @@ std::pair consistentProperty(const char *lhs, return std::make_pair(true, lhs); } -#if defined(_MSC_VER) - static const char* const null_ptr = 0; -#else -# define null_ptr 0 -#endif + const char* const null_ptr = 0; switch(t) { @@ -4868,11 +4856,6 @@ std::pair consistentProperty(const char *lhs, } assert(!"Unreachable!"); return std::pair(false, null_ptr); - -#if !defined(_MSC_VER) -#undef null_ptr -#endif - } template