Skip to content

Commit

Permalink
Fix compilation on MacOS (#498)
Browse files Browse the repository at this point in the history
* Fix macos compilation

* Trying as_deref for a quick solution

* Guess I do have to reference a local variable. Unknown if this will cause issues with the pointer down the line. Since there's no ctx lifetime on the section, this should be fine.
  • Loading branch information
BigBadE authored May 18, 2024
1 parent 7684346 commit 5c9f7fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/values/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,15 @@ impl<'ctx> Value<'ctx> {
/// Sets the section of the global value
fn set_section(self, section: Option<&str>) {
#[cfg(target_os = "macos")]
let section = section.map(|s| {
let mapped_section = section.map(|s| {
if s.contains(",") {
format!("{}", s)
} else {
format!(",{}", s)
}
});
#[cfg(target_os = "macos")]
let section = mapped_section.as_deref();

let c_string = section.map(to_c_str);

Expand Down

0 comments on commit 5c9f7fc

Please sign in to comment.