From 325deba3f28ea34c5d8a5c389d2c44e73d045230 Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Thu, 23 May 2024 09:02:31 +0000 Subject: [PATCH] fmt --- include/ccf/js/modules.h | 19 +++++++++++-------- .../apps/basic/custom_endpoints/registry.h | 7 ++++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/ccf/js/modules.h b/include/ccf/js/modules.h index 556396e7c07d..4e0685d71615 100644 --- a/include/ccf/js/modules.h +++ b/include/ccf/js/modules.h @@ -5,7 +5,6 @@ #include "ccf/ds/logger.h" #include "ccf/service/tables/modules.h" #include "ccf/tx.h" - #include "ccf/version.h" #include @@ -13,10 +12,14 @@ namespace ccf::js { static inline js::core::JSWrappedValue load_app_module( - JSContext* ctx, const char* module_name, kv::Tx* tx, + JSContext* ctx, + const char* module_name, + kv::Tx* tx, const std::string& modules_map = ccf::Tables::MODULES, - const std::string& modules_quickjs_bytecode_map = ccf::Tables::MODULES_QUICKJS_BYTECODE, - const std::string& modules_quickjs_version_map = ccf::Tables::MODULES_QUICKJS_VERSION) + const std::string& modules_quickjs_bytecode_map = + ccf::Tables::MODULES_QUICKJS_BYTECODE, + const std::string& modules_quickjs_version_map = + ccf::Tables::MODULES_QUICKJS_VERSION) { js::core::Context& jsctx = *(js::core::Context*)JS_GetContextOpaque(ctx); @@ -38,13 +41,13 @@ namespace ccf::js const auto modules = tx->ro(modules_map); std::optional> bytecode; - const auto modules_quickjs_bytecode = tx->ro( - modules_quickjs_bytecode_map); + const auto modules_quickjs_bytecode = + tx->ro(modules_quickjs_bytecode_map); bytecode = modules_quickjs_bytecode->get(module_name_kv); if (bytecode) { - auto modules_quickjs_version = tx->ro( - modules_quickjs_version_map); + auto modules_quickjs_version = + tx->ro(modules_quickjs_version_map); if (modules_quickjs_version->get() != std::string(ccf::quickjs_version)) bytecode = std::nullopt; } diff --git a/samples/apps/basic/custom_endpoints/registry.h b/samples/apps/basic/custom_endpoints/registry.h index 993471c8b802..0f3e95d0e10e 100644 --- a/samples/apps/basic/custom_endpoints/registry.h +++ b/samples/apps/basic/custom_endpoints/registry.h @@ -285,11 +285,12 @@ namespace basicapp const auto& props = endpoint->properties; // Needs #6199 auto module_val = ccf::js::load_app_module( - ctx, props.js_module.c_str(), &endpoint_ctx.tx, + ctx, + props.js_module.c_str(), + &endpoint_ctx.tx, "public:custom_endpoints.modules", "public:custom_endpoints.modules_quickjs_bytecode", - "public:custom_endpoints.modules_quickjs_version" - ); + "public:custom_endpoints.modules_quickjs_version"); export_func = ctx.get_exported_function( module_val, props.js_function, props.js_module); }