Skip to content

Commit

Permalink
[#96] Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Feb 9, 2024
1 parent ff73855 commit ecf16f6
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 22 deletions.
5 changes: 5 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@
* Buddy allocator for sender data-segment
* Introduce runtime fixed-size types

## Expert/Advanced Features

* [ ] Filtering/Routing of messages in pub-sub
* [ ] Handle approach to resend samples that could not be delivered caused by a full queue in pub-sub

## Robustness

* [ ] Add ability to recover samples when subscriber died
Expand Down
3 changes: 0 additions & 3 deletions doc/release-notes/iceoryx2-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
// set sample value
sample.send()?;
```
<<<<<<< HEAD

2. All port `Publisher`, `Subscriber`, `Listener` and `Notifier` no longer have a generic
`'config` lifetime parameter.
Expand Down Expand Up @@ -116,5 +115,3 @@
// new
fn my_generic_service_function<ServiceType: iceoryx2::service::Service>();
```
=======
>>>>>>> 5c3362d ([#96] Document ProcessState)
16 changes: 8 additions & 8 deletions iceoryx2-bb/lock-free/src/mpmc/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,14 @@ impl<T: Copy + Debug> Container<T> {
///
pub unsafe fn add(&self, value: T) -> Option<UniqueIndex<'_>> {
self.verify_memory_initialization("add");
match self
.index_set
.acquire_with_additional_cleanup(|index: u32| {
// set deactivate the active index to indicate that the value can be used again
// requires that T does not implement drop
unsafe { &*self.active_index_ptr.as_ptr().offset(index as isize) }
.store(false, Ordering::Relaxed);
}) {
let cleanup_call = |index: u32| {
// set deactivate the active index to indicate that the value can be used again
// requires that T does not implement drop
unsafe { &*self.active_index_ptr.as_ptr().offset(index as isize) }
.store(false, Ordering::Relaxed);
};

match self.index_set.acquire_with_additional_cleanup(cleanup_call) {
Some(index) => {
unsafe {
*(*self.data_ptr.as_ptr().offset(index.value() as isize)).get() =
Expand Down
1 change: 0 additions & 1 deletion iceoryx2-bb/posix/src/process_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ pub enum ProcessGuardCreateError {
UnknownError(i32),
}

/// Defines all errors that can occur when a new [`ProcessMonitor`] is created.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
enum ProcessGuardLockError {
OwnedByAnotherProcess,
Expand Down
5 changes: 3 additions & 2 deletions iceoryx2-bb/posix/src/shared_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,10 @@ impl SharedMemoryCreationBuilder {

if self.config.zero_memory {
if POSIX_SUPPORT_ADVANCED_SIGNAL_HANDLING {
match SignalHandler::call_and_fetch(|| unsafe {
let memset_call = || unsafe {
posix::memset(shm.base_address as *mut posix::void, 0, self.config.size);
}) {
};
match SignalHandler::call_and_fetch(memset_call) {
None => (),
Some(v) => {
fail!(from self.config, with SharedMemoryCreationError::InsufficientMemory,
Expand Down
6 changes: 4 additions & 2 deletions iceoryx2-bb/posix/src/udp_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,11 @@ impl UdpClient {
"This should never happen! {} since the socket could not be attached to a fd set.", msg);

let mut received_bytes = Ok(0);
match fd_set.timed_wait(timeout, FileEvent::Read, |_| {
let receive_call = |_: &FileDescriptor| {
received_bytes = self.socket.receive(buffer);
}) {
};

match fd_set.timed_wait(timeout, FileEvent::Read, receive_call) {
Err(FileDescriptorSetWaitError::Interrupt) => {
fail!(from self, with UdpReceiveError::Interrupt,
"{} since an interrupt signal was received.", msg);
Expand Down
1 change: 1 addition & 0 deletions iceoryx2-pal/posix/src/macos/pthread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ pub unsafe fn pthread_cond_timedwait(
mutex: *mut pthread_mutex_t,
abstime: *const timespec,
) -> int {
#[allow(clippy::blocks_in_conditions)]
match (*cond).cv.wait(
&(*mutex).mtx,
wake_one,
Expand Down
13 changes: 7 additions & 6 deletions iceoryx2/src/service/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use iceoryx2_bb_container::semantic_string::SemanticString;
use iceoryx2_bb_elementary::enum_gen;
use iceoryx2_bb_log::fail;
use iceoryx2_bb_log::fatal_panic;
use iceoryx2_bb_memory::bump_allocator::BumpAllocator;
use iceoryx2_bb_system_types::file_name::FileName;
use iceoryx2_cal::dynamic_storage::DynamicStorageCreateError;
use iceoryx2_cal::dynamic_storage::DynamicStorageOpenError;
Expand Down Expand Up @@ -236,6 +237,11 @@ impl<ServiceType: service::Service> BuilderWithServiceType<ServiceType> {
}
}

fn config_init_call(config: &mut DynamicConfig, allocator: &mut BumpAllocator) -> bool {
unsafe { config.init(allocator) };
true
}

fn create_dynamic_config_storage(
&self,
messaging_pattern: super::dynamic_config::MessagingPattern,
Expand All @@ -249,12 +255,7 @@ impl<ServiceType: service::Service> BuilderWithServiceType<ServiceType> {
.config(&dynamic_config_storage_config::<ServiceType>(self.global_config.as_ref()))
.supplementary_size(additional_size)
.has_ownership(false)
.create_and_initialize(DynamicConfig::new_uninit(messaging_pattern),
|config, allocator| {
unsafe { config.init(allocator) };
true
}
) {
.create_and_initialize(DynamicConfig::new_uninit(messaging_pattern), Self::config_init_call ) {
Ok(dynamic_storage) => Ok(dynamic_storage),
Err(e) => {
fail!(from self, with e, "Failed to create dynamic storage for service.");
Expand Down

0 comments on commit ecf16f6

Please sign in to comment.