Skip to content

Commit

Permalink
Bypass redundant version functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Nov 15, 2022
1 parent 2daa042 commit 5b8d94a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
12 changes: 6 additions & 6 deletions crates/fj-host/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ impl Model {
} else {
let version_pkg_host = fj::version::VERSION_PKG.to_string();

let version_pkg_model: libloading::Symbol<fn() -> Version> =
lib.get(b"version_pkg").map_err(Error::LoadingVersion)?;
let version_pkg_mode = version_pkg_model().to_string();
let version_pkg_model: libloading::Symbol<*const Version> =
lib.get(b"VERSION_PKG").map_err(Error::LoadingVersion)?;
let version_pkg_mode = (**version_pkg_model).to_string();

debug!(
"Comparing package versions (host: {}, model: {})",
Expand All @@ -132,9 +132,9 @@ impl Model {

let version_full_host = fj::version::VERSION_FULL.to_string();

let version_full_model: libloading::Symbol<fn() -> Version> =
lib.get(b"version_full").map_err(Error::LoadingVersion)?;
let version_full_model = version_full_model().to_string();
let version_full_model: libloading::Symbol<*const Version> =
lib.get(b"VERSION_FULL").map_err(Error::LoadingVersion)?;
let version_full_model = (**version_full_model).to_string();

debug!(
"Comparing full versions (host: {}, model: {})",
Expand Down
10 changes: 0 additions & 10 deletions crates/fj/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,3 @@ unsafe impl Send for Version {}
// There is no reason why a `&Version` wouldn't be `Send`, so per definition,
// `Version` can be `Sync`.
unsafe impl Sync for Version {}

#[no_mangle]
extern "C" fn version_pkg() -> Version {
VERSION_PKG
}

#[no_mangle]
extern "C" fn version_full() -> Version {
VERSION_FULL
}

0 comments on commit 5b8d94a

Please sign in to comment.