-
Notifications
You must be signed in to change notification settings - Fork 126
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
Implement copy function for C messages #650
Conversation
f2bbeb6
to
cd3469b
Compare
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
cd3469b
to
43944c9
Compare
* This functions performs a deep copy, as opposed to the shallow copy that | ||
* plain assignment yields. | ||
* | ||
* \param[out] input a pointer to a rosidl_runtime_c__String structure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* \param[out] input a pointer to a rosidl_runtime_c__String structure | |
* \param[in] input a pointer to a rosidl_runtime_c__String structure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in ab79f66.
rosidl_runtime_c/include/rosidl_runtime_c/u16string_functions.h
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments, otherwise looks good to me. Great work.
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
* Implement equality operator function for C messages. (#648) Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com> * Implement copy function for C messages (#650) Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com> * Replace rcutils_allocator with the system allocator Signed-off-by: Nikolai Morin <nnmmgit@gmail.com> * Set the output size unconditionally when copying sequences Signed-off-by: Nikolai Morin <nnmmgit@gmail.com> Co-authored-by: Michel Hidalgo <michel@ekumenlabs.com>
* Implement equality operator function for C messages. (#648) Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com> * Implement copy function for C messages (#650) Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com> * Replace rcutils_allocator with the system allocator Signed-off-by: Nikolai Morin <nnmmgit@gmail.com> * Set the output size unconditionally when copying sequences Signed-off-by: Nikolai Morin <nnmmgit@gmail.com> Co-authored-by: Michel Hidalgo <michel@ekumenlabs.com>
Precisely what the title says. While C++ messages overload the assignment operator, plain assignment of C messages results in shallow copy of pointers which in turn leads to ownership issues (e.g. double free crashes) down the line. This patch amends this.
Depends on #648.