Skip to content

Commit

Permalink
remove AsCChars from linux; more clone_from replacements
Browse files Browse the repository at this point in the history
Signed-off-by: Walker Crouse <[email protected]>
  • Loading branch information
windy1 committed Jul 26, 2024
1 parent fd3dc5d commit a3932bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion zeroconf/src/avahi/browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl TMdnsBrowser for AvahiMdnsBrowser {
.build()?,
)?));

self.context.client = self.client.clone();
self.context.client.clone_from(&self.client);

unsafe {
if let Err(e) = create_browser(&mut self.context) {
Expand Down
2 changes: 1 addition & 1 deletion zeroconf/src/avahi/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl TMdnsService for AvahiMdnsService {
.build()?,
)?));

self.context.client = self.client.clone();
self.context.client.clone_from(&self.client);

unsafe {
if let Err(e) = create_service(&mut self.context) {
Expand Down
2 changes: 2 additions & 0 deletions zeroconf/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ use libc::c_char;
use std::ffi::{CStr, CString};

/// Helper trait to map to `Option<*const c_char>`.
#[cfg(not(target_os = "linux"))]
pub trait AsCChars {
/// Maps the type to a `Option<*const c_char>`.
fn as_c_chars(&self) -> Option<*const c_char>;
}

#[cfg(not(target_os = "linux"))]
impl AsCChars for Option<&CString> {
fn as_c_chars(&self) -> Option<*const c_char> {
self.map(|s| s.as_ptr() as *const c_char)
Expand Down

0 comments on commit a3932bf

Please sign in to comment.