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

Document that useAsCStringLen does not append NUL #612

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

Bodigrim
Copy link
Contributor

Following up on haskell/unix#295 (comment).

-- It must not be stored or used after the subcomputation finishes.
--
-- Beware that this function does not add a terminating @\NUL@ byte at the end of 'CStringLen'.
Copy link
Member

Choose a reason for hiding this comment

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

It looks like the implementation actually does currently append a null byte, but I agree that doing so is not part of this function's contract.

Suggested change
-- Beware that this function does not add a terminating @\NUL@ byte at the end of 'CStringLen'.
-- Beware that this function is not required to add a terminating @\NUL@ byte at the end of the 'CStringLen' it provides.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, it's ShortByteString version who does not add it, but ByteString one currently does.

Co-authored-by: Matthew Craven <clyring@gmail.com>
@clyring clyring merged commit 6034af8 into haskell:master Sep 15, 2023
24 checks passed
@Bodigrim Bodigrim deleted the document-useAsCStringLen branch September 15, 2023 23:35
@Bodigrim Bodigrim added this to the 0.12.1.0 milestone Sep 15, 2023
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.

None yet

2 participants