Skip to content

Commit

Permalink
[eclipse-iceoryx#264] Fix dangling c_str pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Sep 9, 2024
1 parent 27aecd9 commit ebd9c2a
Show file tree
Hide file tree
Showing 29 changed files with 161 additions and 165 deletions.
12 changes: 6 additions & 6 deletions iceoryx2-cal/src/communication_channel/message_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,22 +161,22 @@ impl Default for Configuration {
}

impl NamedConceptConfiguration for Configuration {
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn path_hint(mut self, value: Path) -> Self {
self.path_hint = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path_hint = *value;
self
}

Expand Down
16 changes: 8 additions & 8 deletions iceoryx2-cal/src/communication_channel/posix_shared_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,28 +94,28 @@ impl Default for Configuration {
impl From<Configuration> for dynamic_storage::posix_shared_memory::Configuration<Management> {
fn from(value: Configuration) -> Self {
Self::default()
.suffix(value.suffix)
.path_hint(value.path_hint)
.suffix(&value.suffix)
.path_hint(&value.path_hint)
}
}

impl NamedConceptConfiguration for Configuration {
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn path_hint(mut self, value: Path) -> Self {
self.path_hint = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path_hint = *value;
self
}

Expand Down
12 changes: 6 additions & 6 deletions iceoryx2-cal/src/communication_channel/process_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,22 @@ impl Default for Configuration {
}

impl NamedConceptConfiguration for Configuration {
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn path_hint(mut self, value: Path) -> Self {
self.path_hint = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path_hint = *value;
self
}

Expand Down
12 changes: 6 additions & 6 deletions iceoryx2-cal/src/communication_channel/unix_datagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ impl Default for Configuration {
}

impl NamedConceptConfiguration for Configuration {
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn path_hint(mut self, value: Path) -> Self {
self.path_hint = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path_hint = *value;
self
}

Expand Down
12 changes: 6 additions & 6 deletions iceoryx2-cal/src/dynamic_storage/posix_shared_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,22 @@ impl<T: Send + Sync + Debug> Default for Configuration<T> {
impl<T: Send + Sync + Debug> DynamicStorageConfiguration<T> for Configuration<T> {}

impl<T: Send + Sync + Debug> NamedConceptConfiguration for Configuration<T> {
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn path_hint(mut self, value: Path) -> Self {
self.path = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path = *value;
self
}

Expand Down
12 changes: 6 additions & 6 deletions iceoryx2-cal/src/dynamic_storage/process_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,22 @@ impl<T: Send + Sync + Debug> Default for Configuration<T> {
impl<T: Send + Sync + Debug> DynamicStorageConfiguration<T> for Configuration<T> {}

impl<T: Send + Sync + Debug> NamedConceptConfiguration for Configuration<T> {
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn path_hint(mut self, value: Path) -> Self {
self.path_hint = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path_hint = *value;
self
}

Expand Down
18 changes: 9 additions & 9 deletions iceoryx2-cal/src/event/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ pub mod details {
{
fn convert(&self) -> <Storage as NamedConceptMgmt>::Configuration {
<Storage as NamedConceptMgmt>::Configuration::default()
.prefix(self.prefix)
.suffix(self.suffix)
.path_hint(self.path)
.prefix(&self.prefix)
.suffix(&self.suffix)
.path_hint(&self.path)
}
}

Expand Down Expand Up @@ -133,22 +133,22 @@ pub mod details {
Storage: DynamicStorage<Management<Tracker, WaitMechanism>>,
> NamedConceptConfiguration for Configuration<Tracker, WaitMechanism, Storage>
{
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn path_hint(mut self, value: Path) -> Self {
self.path = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path = *value;
self
}

Expand Down
12 changes: 6 additions & 6 deletions iceoryx2-cal/src/event/process_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,22 @@ impl Default for Configuration {
}

impl NamedConceptConfiguration for Configuration {
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn path_hint(mut self, value: Path) -> Self {
self.path = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path = *value;
self
}

Expand Down
14 changes: 7 additions & 7 deletions iceoryx2-cal/src/event/unix_datagram_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ impl Default for Configuration {
}

impl NamedConceptConfiguration for Configuration {
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn path_hint(mut self, value: Path) -> Self {
self.path = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path = *value;
self
}

Expand All @@ -71,7 +71,7 @@ impl NamedConceptConfiguration for Configuration {

impl From<Configuration> for crate::communication_channel::unix_datagram::Configuration {
fn from(value: Configuration) -> Self {
Self::default().suffix(value.suffix).path_hint(value.path)
Self::default().suffix(&value.suffix).path_hint(&value.path)
}
}

Expand Down
12 changes: 6 additions & 6 deletions iceoryx2-cal/src/monitoring/file_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,26 +339,26 @@ impl Default for Configuration {
}

impl NamedConceptConfiguration for Configuration {
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn get_suffix(&self) -> &FileName {
&self.suffix
}

fn path_hint(mut self, value: Path) -> Self {
self.path_hint = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path_hint = *value;
self
}

Expand Down
12 changes: 6 additions & 6 deletions iceoryx2-cal/src/monitoring/process_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,26 @@ impl Default for Configuration {
}

impl NamedConceptConfiguration for Configuration {
fn prefix(mut self, value: FileName) -> Self {
self.prefix = value;
fn prefix(mut self, value: &FileName) -> Self {
self.prefix = *value;
self
}

fn get_prefix(&self) -> &FileName {
&self.prefix
}

fn suffix(mut self, value: FileName) -> Self {
self.suffix = value;
fn suffix(mut self, value: &FileName) -> Self {
self.suffix = *value;
self
}

fn get_suffix(&self) -> &FileName {
&self.suffix
}

fn path_hint(mut self, value: Path) -> Self {
self.path_hint = value;
fn path_hint(mut self, value: &Path) -> Self {
self.path_hint = *value;
self
}

Expand Down
6 changes: 3 additions & 3 deletions iceoryx2-cal/src/named_concept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ pub enum NamedConceptPathHintRemoveError {
/// underlying resource does not support it.
pub trait NamedConceptConfiguration: Default + Clone + Debug {
/// Defines the prefix that the concept will use.
fn prefix(self, value: FileName) -> Self;
fn prefix(self, value: &FileName) -> Self;

/// Returns the configurations prefix.
fn get_prefix(&self) -> &FileName;

/// Defines the suffix that the concept will use.
fn suffix(self, value: FileName) -> Self;
fn suffix(self, value: &FileName) -> Self;

/// Sets a path hint under which the underlying resources shall be stored. When the concept
/// uses resources like [`iceoryx2_bb_posix::shared_memory::SharedMemory`] the path will be
/// ignored.
fn path_hint(self, value: Path) -> Self;
fn path_hint(self, value: &Path) -> Self;

/// Returns the configurations suffix.
fn get_suffix(&self) -> &FileName;
Expand Down
Loading

0 comments on commit ebd9c2a

Please sign in to comment.