Skip to content

Commit

Permalink
Merge pull request #682 from DenisBiryukov91/writer-docs
Browse files Browse the repository at this point in the history
update docs regarding undefined behavior when using multiple z_bytes_writers
  • Loading branch information
milyin authored Sep 13, 2024
2 parents c453da5 + d9d17c2 commit 20580b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/zenoh_commons.h
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,8 @@ ZENOHC_API struct z_bytes_reader_t z_bytes_get_reader(const struct z_loaned_byte
ZENOHC_API
struct z_bytes_slice_iterator_t z_bytes_get_slice_iterator(const struct z_loaned_bytes_t *this_);
/**
* Gets writer for `this_`.
* @brief Gets writer for`this_`.
* @note Creating another writer while previous one is still in use is undefined behaviour.
*/
ZENOHC_API struct z_bytes_writer_t z_bytes_get_writer(struct z_loaned_bytes_t *this_);
/**
Expand Down
3 changes: 2 additions & 1 deletion src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,8 @@ pub use crate::opaque_types::z_bytes_writer_t;

decl_c_type! {loaned(z_bytes_writer_t, ZBytesWriter<'static>)}

/// Gets writer for `this_`.
/// @brief Gets writer for`this_`.
/// @note Creating another writer while previous one is still in use is undefined behaviour.
#[no_mangle]
extern "C" fn z_bytes_get_writer(this: &'static mut z_loaned_bytes_t) -> z_bytes_writer_t {
*this.as_rust_type_mut().writer().as_loaned_c_type_ref()
Expand Down

0 comments on commit 20580b8

Please sign in to comment.