Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

z_bytes_serialize_from_str aliases it's argument which is not clear from function's name #553

Closed
milyin opened this issue Jul 29, 2024 · 2 comments
Labels
release Part of the next release

Comments

@milyin
Copy link
Contributor

milyin commented Jul 29, 2024

Describe the release item

The function

ZENOHC_API void z_bytes_serialize_from_str(struct z_owned_bytes_t *this_, const char *s);

actually stores s pointer inside created z_owned_bytes_t.

This raises 2 problems:

  • from the function name it's not clear, without looking into docs user may think that data is copied
  • even if user knows how this works, he have no way to know at which moment the s is ready to be freed. When z_owned_bytes_t is consumed by z_put for example, there is no guarantee that after z_put call the s is not kept in some queue inside zenoh. So actually this function is useful for static strings only
@milyin milyin added the release Part of the next release label Jul 29, 2024
@milyin milyin changed the title z_bytes_serialize_from_str aliases it's argument which is not clear from it's name z_bytes_serialize_from_str aliases it's argument which is not clear from it's name Jul 29, 2024
@milyin milyin changed the title z_bytes_serialize_from_str aliases it's argument which is not clear from it's name z_bytes_serialize_from_str aliases it's argument which is not clear from function's name Jul 29, 2024
@milyin
Copy link
Contributor Author

milyin commented Jul 29, 2024

PRs related:
#554
eclipse-zenoh/zenoh-pico#56

@milyin
Copy link
Contributor Author

milyin commented Aug 1, 2024

fixed in corresponding prs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Part of the next release
Projects
Status: Done
Development

No branches or pull requests

1 participant