From fc97025802effcea92d80f6038e5c8ba1a05560e Mon Sep 17 00:00:00 2001 From: Nicola Cabiddu Date: Fri, 12 Jul 2024 11:03:08 +0100 Subject: [PATCH] code review --- src/realm.h | 2 -- src/realm/object-store/c_api/schema.cpp | 10 ++++------ test/object-store/c_api/c_api.cpp | 2 -- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/realm.h b/src/realm.h index 4c4a68ce97..255988f2d2 100644 --- a/src/realm.h +++ b/src/realm.h @@ -1243,8 +1243,6 @@ RLM_API uint64_t realm_get_schema_version(const realm_t* realm); /** * Get the schema version for this realm at the path. - * - * This function cannot fail. */ RLM_API uint64_t realm_get_persisted_schema_version(const realm_config_t* config); diff --git a/src/realm/object-store/c_api/schema.cpp b/src/realm/object-store/c_api/schema.cpp index f6ca0a9b05..3b682cb9f9 100644 --- a/src/realm/object-store/c_api/schema.cpp +++ b/src/realm/object-store/c_api/schema.cpp @@ -68,13 +68,11 @@ RLM_API uint64_t realm_get_persisted_schema_version(const realm_config_t* config conf.force_sync_history = true; } - return wrap_err([&]() { - auto realm = new shared_realm{Realm::get_shared_realm(conf)}; - uint64_t version = ObjectStore::get_schema_version(realm->get()->read_group()); - delete realm; + auto realm = new shared_realm{Realm::get_shared_realm(conf)}; + uint64_t version = ObjectStore::get_schema_version(realm->get()->read_group()); + delete realm; - return version; - }); + return version; } RLM_API bool realm_schema_validate(const realm_schema_t* schema, uint64_t validation_mode) diff --git a/test/object-store/c_api/c_api.cpp b/test/object-store/c_api/c_api.cpp index e6afc8c8e6..7edad0de6e 100644 --- a/test/object-store/c_api/c_api.cpp +++ b/test/object-store/c_api/c_api.cpp @@ -5890,8 +5890,6 @@ TEST_CASE("C API - async_open", "[sync][pbs][c_api]") { realm_t* realm = realm_from_thread_safe_reference(userdata.realm_ref, nullptr); realm_release(userdata.realm_ref); - REQUIRE(realm_get_persisted_schema_version(config) == 0); - bool found; realm_class_info_t class_info; realm_find_class(realm, "object", &found, &class_info);