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

Better support and testing for empty string_array #246

Merged
merged 2 commits into from
May 27, 2020
Merged

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented May 13, 2020

Specifically test for string_arrays of size 0, and relax the null check in rcutils_string_array_cmp when it won't be used.

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay cottsay added the enhancement New feature or request label May 13, 2020
@cottsay cottsay self-assigned this May 13, 2020
@cottsay cottsay added the in review Waiting for review (Kanban column) label May 13, 2020
@cottsay
Copy link
Member Author

cottsay commented May 20, 2020

@dirk-thomas, I'm re-requesting review because I added a change to handle some inconsistent behavior due to an assumption based on implementation-specific behavior in malloc.

Here are some docs, which describe what might happen if you malloc/realloc with size 0: http://man7.org/linux/man-pages/man3/malloc.3.html

@cottsay cottsay requested a review from dirk-thomas May 20, 2020 00:44
The documentation for malloc states that an attempt to allocate memory
of size 0 results in implementation-specific behavior. Some
implementations return `NULL`, and others return a pointer that is
expected to be `free`'d.

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay cottsay force-pushed the empty_string_array branch from 958369a to abed4ac Compare May 20, 2020 01:52
@wjwwood
Copy link
Member

wjwwood commented May 26, 2020

@cottsay do you want to try to get this and the other pr's you opened into rcutils before I do a 1.0.0 release? I can try to help make that happen, but I also do not want to delay too long.

@cottsay
Copy link
Member Author

cottsay commented May 26, 2020

@cottsay do you want to try to get this and the other pr's you opened into rcutils before I do a 1.0.0 release? I can try to help make that happen, but I also do not want to delay too long.

At this point, it would just be "nice to have." I'm not sure I'll have time to actually take advantage of these changes before the release anyway. This one and #252 are a higher priority IMHO - they both improve the behavior of existing functions.

@cottsay cottsay merged commit f9bf1f0 into master May 27, 2020
@delete-merged-branch delete-merged-branch bot deleted the empty_string_array branch May 27, 2020 05:27
@cottsay
Copy link
Member Author

cottsay commented May 27, 2020

@cottsay do you want to try to get this and the other pr's you opened into rcutils before I do a 1.0.0 release? I can try to help make that happen, but I also do not want to delay too long.

Since I closed #252, I think you should move ahead with the release without the other two API additions. Thanks, @wjwwood!

@wjwwood
Copy link
Member

wjwwood commented May 27, 2020

I'm rerunning CI to include more, in case this change in behavior of string array causes a failure downstream:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@wjwwood
Copy link
Member

wjwwood commented May 27, 2020

Oops missed the fact that you merged it. I'll cancel those CI and see what the nightlys bring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in review Waiting for review (Kanban column)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants