qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [3/6] qpid-proton git commit: NO-JIRA: [C++ binding] Unifying safe conversion from const char* -> std::string
Date Thu, 28 Apr 2016 00:48:11 GMT
NO-JIRA: [C++ binding] Unifying safe conversion from const char* -> std::string


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/25984b80
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/25984b80
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/25984b80

Branch: refs/heads/master
Commit: 25984b80f678df142203fb868f612dfefde486d2
Parents: 75faa18
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Wed Apr 27 17:57:46 2016 -0400
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Wed Apr 27 17:58:40 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/src/error_condition.cpp | 11 ++++-------
 proton-c/bindings/cpp/src/proton_bits.hpp     |  2 +-
 2 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/25984b80/proton-c/bindings/cpp/src/error_condition.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/error_condition.cpp b/proton-c/bindings/cpp/src/error_condition.cpp
index 07abddb..b575596 100644
--- a/proton-c/bindings/cpp/src/error_condition.cpp
+++ b/proton-c/bindings/cpp/src/error_condition.cpp
@@ -20,17 +20,14 @@
  */
 #include "proton/error_condition.hpp"
 #include "proton/condition.h"
-namespace {
-inline std::string safe_convert(const char* s) {
-    return s ? s : std::string();
-}
-}
+
+#include "proton_bits.hpp"
 
 namespace proton {
 
 error_condition::error_condition(pn_condition_t* c) :
-    name_(safe_convert(pn_condition_get_name(c))),
-    description_(safe_convert(pn_condition_get_description(c))),
+    name_(str(pn_condition_get_name(c))),
+    description_(str(pn_condition_get_description(c))),
     properties_(pn_condition_info(c))
 {}
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/25984b80/proton-c/bindings/cpp/src/proton_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.hpp b/proton-c/bindings/cpp/src/proton_bits.hpp
index 0c244c5..a3f2039 100644
--- a/proton-c/bindings/cpp/src/proton_bits.hpp
+++ b/proton-c/bindings/cpp/src/proton_bits.hpp
@@ -47,7 +47,7 @@ std::ostream& operator<<(std::ostream& o, const inspectable&
object);
 void set_error_condition(const error_condition&, pn_condition_t*);
 
 /// Convert a const char* to std::string, convert NULL to the empty string.
-inline std::string str(const char* s) { return s ? s : ""; }
+inline std::string str(const char* s) { return s ? s : std::string(); }
 
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message