empiredan commented on code in PR #1843:
URL: 
https://github.com/apache/incubator-pegasus/pull/1843#discussion_r1454706115


##########
src/http/http_client.cpp:
##########
@@ -34,6 +34,135 @@ DSN_DEFINE_uint32(http,
                   "The maximum time in milliseconds that you allow the libcurl 
transfer operation "
                   "to complete");
 
+#define RETURN_IF_CURL_NOT(expr, expected, ...)                                
                    \
+    do {                                                                       
                    \
+        const auto code = (expr);                                              
                    \
+        if (dsn_unlikely(code != expected)) {                                  
                    \
+            std::string msg(fmt::format("{}: {}", fmt::format(__VA_ARGS__), 
to_error_msg(code)));  \
+            return dsn::error_s::make(to_error_code(code), msg);               
                    \
+        }                                                                      
                    \
+    } while (0)
+
+http_url::http_url() : _url(nullptr) {}
+
+http_url::~http_url() { free_curlu_object(); }
+
+http_url::http_url(http_url &&rhs) : _url(rhs._url) { rhs._url = nullptr; }
+
+http_url &http_url::operator=(http_url &&rhs)
+{
+    _url = rhs._url;

Review Comment:
   I've wrapped it with `std::unique_ptr` to avoid the problem, and add test 
cases for copy/move constructors, copy/move assignment operators.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to