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

[#210] Fix node and service name C API #405

Conversation

elBoberido
Copy link
Member

@elBoberido elBoberido commented Sep 27, 2024

Notes for Reviewer

The node and service name C-API pretent to return a null terminated C-style string. This is not the case though, since the Rust NodeName and ServiceName is based on a Rust String and not on an iceoryx2 SemanticString.

This PR fixes the documentation and makes passing a pointer for the string length mandatory.

Pre-Review Checklist for the PR Author

  1. Add sensible notes for the reviewer
  2. PR title is short, expressive and meaningful
  3. Relevant issues are linked in the References section
  4. Every source code file has a copyright header with SPDX-License-Identifier: Apache-2.0 OR MIT
  5. Branch follows the naming format (iox2-123-introduce-posix-ipc-example)
  6. Commits messages are according to this guideline
  7. Tests follow the best practice for testing
  8. Changelog updated in the unreleased section including API breaking changes
  9. Assign PR to reviewer
  10. All checks have passed (except task-list-completed)

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

Relates to #210

@@ -29,12 +29,12 @@ fn basic_node_name_test() -> Result<(), Box<dyn std::error::Error>> {
assert_that!(ret_val, eq(IOX2_OK));

let mut node_name_len = 0;
let node_name_c_str = iox2_node_name_as_c_str(
let node_name_c_ptr = iox2_node_name_as_str(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elBoberido The name node_name_c_ptr causes me to scratch my head on first read. It's because it is just a pointer to chars (i.e. not null terminated)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elBoberido Maybe node_name_chars ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the function then be named iox2_node_name_as_chars?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elBoberido Works for me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked the function name since str has this implicit null-termination in the C world and chars is great for just a char array.

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.95%. Comparing base (a9cc0a3) to head (3870c48).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #405      +/-   ##
==========================================
- Coverage   78.99%   78.95%   -0.04%     
==========================================
  Files         194      194              
  Lines       22730    22730              
==========================================
- Hits        17955    17946       -9     
- Misses       4775     4784       +9     

see 5 files with indirect coverage changes

@elBoberido elBoberido requested a review from orecham September 27, 2024 22:58
@elBoberido
Copy link
Member Author

We reached the Cirrus CI limit. Merging anyway since the github CI is our main CI.

@elBoberido elBoberido merged commit 3a6b384 into eclipse-iceoryx:main Sep 27, 2024
49 of 56 checks passed
@elBoberido elBoberido deleted the iox2-210-fix-node-name-and-service-name-c-api branch September 27, 2024 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants