Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace needless std::map with std::vector, and std::move in capture #913

Merged
merged 1 commit into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ namespace eosio {
* a handler. The URL is the path on the web server that triggers the
* call, and the handler is the function which implements the API call
*/
using api_description = std::map<string, url_handler>;
using api_entry = std::pair<string, url_handler>;
using api_description = std::vector<api_entry>;

enum class http_content_type {
json = 1,
Expand Down
2 changes: 1 addition & 1 deletion plugins/http_plugin/include/eosio/http_plugin/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct async_result_visitor : public fc::visitor<fc::variant> {
auto params = parse_params<api_namespace::call_name ## _params, params_type>(body);\
FC_CHECK_DEADLINE(deadline);\
api_handle.call_name( std::move(params), \
[cb, body](const std::variant<fc::exception_ptr, call_result>& result){\
[cb=std::move(cb), body=std::move(body)](const std::variant<fc::exception_ptr, call_result>& result){ \
heifner marked this conversation as resolved.
Show resolved Hide resolved
if (std::holds_alternative<fc::exception_ptr>(result)) {\
try {\
std::get<fc::exception_ptr>(result)->dynamic_rethrow_exception();\
Expand Down
2 changes: 1 addition & 1 deletion plugins/producer_api_plugin/producer_api_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct async_result_visitor : public fc::visitor<fc::variant> {
{std::string("/v1/" #api_name "/" #call_name), \
[&api_handle](string&&, string&& body, url_response_callback&& cb) mutable { \
if (body.empty()) body = "{}"; \
auto next = [cb, body](const std::variant<fc::exception_ptr, call_result>& result){\
auto next = [cb=std::move(cb), body=std::move(body)](const std::variant<fc::exception_ptr, call_result>& result){ \
heifner marked this conversation as resolved.
Show resolved Hide resolved
if (std::holds_alternative<fc::exception_ptr>(result)) {\
try {\
std::get<fc::exception_ptr>(result)->dynamic_rethrow_exception();\
Expand Down