1515#include " runtime-light/stdlib/curl/curl-state.h"
1616#include " runtime-light/stdlib/curl/defs.h"
1717#include " runtime-light/stdlib/curl/details/diagnostics.h"
18- #include " runtime-light/stdlib/diagnostics/logs.h"
1918#include " runtime-light/stdlib/fork/fork-functions.h"
2019#include " runtime-light/stdlib/web-transfer-lib/defs.h"
2120#include " runtime-light/stdlib/web-transfer-lib/details/web-property.h"
@@ -38,11 +37,10 @@ inline auto f$curl_multi_add_handle(kphp::web::curl::multi_type multi_id, kphp::
3837 if (!curl_state.multi_ctx .has (multi_id)) [[unlikely]] {
3938 co_return false ;
4039 }
41- auto & multi_ctx{curl_state.multi_ctx .get_or_init (multi_id)};
42-
4340 if (!curl_state.easy_ctx .has (easy_id)) [[unlikely]] {
4441 co_return false ;
4542 }
43+ auto & multi_ctx{curl_state.multi_ctx .get_or_init (multi_id)};
4644 auto & easy_ctx{curl_state.easy_ctx .get_or_init (easy_id)};
4745 easy_ctx.errors_reset ();
4846
@@ -98,11 +96,11 @@ inline auto f$curl_multi_setopt(kphp::web::curl::multi_type multi_id, int64_t op
9896 kphp::web::curl::print_error (" could not set an mutli option" , std::move (res.error ()));
9997 return false ;
10098 }
101- multi_ctx.set_errno (kphp::web::curl::CURLMcode ::OK);
99+ multi_ctx.set_errno (kphp::web::curl::CURLME ::OK);
102100 return true ;
103101 }
104102 default :
105- multi_ctx.set_errno (kphp::web::curl::CURLMcode ::UNKNOWN_OPTION, " a libcurl function was given an incorrect PROXYTYPE kind" );
103+ multi_ctx.set_errno (kphp::web::curl::CURLME ::UNKNOWN_OPTION, " a libcurl function was given an incorrect PROXYTYPE kind" );
106104 return false ;
107105 }
108106 }
@@ -115,11 +113,11 @@ inline auto f$curl_multi_setopt(kphp::web::curl::multi_type multi_id, int64_t op
115113 kphp::web::curl::print_error (" could not set an multi option" , std::move (res.error ()));
116114 return false ;
117115 }
118- multi_ctx.set_errno (kphp::web::curl::CURLMcode ::OK);
116+ multi_ctx.set_errno (kphp::web::curl::CURLME ::OK);
119117 return true ;
120118 }
121119 default :
122- multi_ctx.set_errno (kphp::web::curl::CURLMcode ::UNKNOWN_OPTION);
120+ multi_ctx.set_errno (kphp::web::curl::CURLME ::UNKNOWN_OPTION);
123121 return false ;
124122 }
125123}
@@ -154,7 +152,7 @@ inline auto f$curl_multi_getcontent(kphp::web::curl::easy_type easy_id) noexcept
154152 kphp::web::curl::print_error (" could not get response of curl easy handle" , std::move (res.error ()));
155153 co_return false ;
156154 }
157- co_return ( *res).body ;
155+ co_return std::move (( *res).body ) ;
158156 }
159157 co_return Optional<string>{};
160158}
@@ -181,7 +179,7 @@ inline auto f$curl_multi_strerror(kphp::web::curl::multi_type multi_id) noexcept
181179 return {};
182180 }
183181 auto & multi_ctx{curl_state.multi_ctx .get_or_init (multi_id)};
184- if (multi_ctx.error_code != static_cast <int64_t >(kphp::web::curl::CURLMcode ::OK)) [[likely]] {
182+ if (multi_ctx.error_code != static_cast <int64_t >(kphp::web::curl::CURLME ::OK)) [[likely]] {
185183 const auto * const desc_data{reinterpret_cast <const char *>(multi_ctx.error_description .data ())};
186184 const auto desc_size{static_cast <string::size_type>(multi_ctx.error_description .size ())};
187185 return string{desc_data, desc_size};
@@ -211,7 +209,7 @@ inline auto f$curl_multi_select(kphp::web::curl::multi_type multi_id, double tim
211209 kphp::web::curl::print_error (" could not select curl multi handle" , std::move (res.error ()));
212210 co_return multi_ctx.error_code ;
213211 }
214- co_return *res ;
212+ co_return std::move (*res_ ;
215213}
216214
217215inline auto f$curl_multi_info_read(kphp::web::curl::multi_type multi_id,
@@ -267,24 +265,24 @@ inline auto f$curl_multi_info_read(kphp::web::curl::multi_type multi_id,
267265 constexpr auto HANDLE_IDX = 3 ;
268266
269267 array<int64_t > result{array_size{3 , false }};
270- if (auto ok{ info.has_key (MSGS_IN_QUEUE)}; ok && msgs_in_queue.has_value ()) {
268+ if (info.has_key (MSGS_IN_QUEUE) && msgs_in_queue.has_value ()) {
271269 (*msgs_in_queue).get () = info.get_value (MSGS_IN_QUEUE);
272270 }
273271
274- if (auto ok{ info.has_key (MSG_IDX)}; ok ) {
272+ if (info.has_key (MSG_IDX)) {
275273 result.set_value (string{" msg" }, info.get_value (MSG_IDX));
276274 }
277275
278- if (auto ok{ info.has_key (RESULT_IDX)}; ok ) {
276+ if (info.has_key (RESULT_IDX)) {
279277 result.set_value (string{" result" }, info.get_value (RESULT_IDX));
280278 }
281279
282- if (auto ok{ info.has_key (HANDLE_IDX)}; ok ) {
280+ if (info.has_key (HANDLE_IDX)) {
283281 auto easy_id{info.get_value (HANDLE_IDX)};
284282 if (curl_state.easy_ctx .has (easy_id)) {
285283 result.set_value (string{" handle" }, info.get_value (HANDLE_IDX));
286284 }
287285 }
288286
289- co_return result;
287+ co_return std::move ( result) ;
290288}
0 commit comments