Skip to content

capi docs: hyper_buf_copy() can return NULL, right? #2563

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

Closed
bagder opened this issue May 28, 2021 · 1 comment · Fixed by #2638
Closed

capi docs: hyper_buf_copy() can return NULL, right? #2563

bagder opened this issue May 28, 2021 · 1 comment · Fixed by #2638
Labels
A-docs Area: documentation. A-ffi Area: ffi (C API) E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@bagder
Copy link
Contributor

bagder commented May 28, 2021

The current comment for hyper_buf_copy in the header says:

/*
 Create a new `hyper_buf *` by copying the provided bytes.

 This makes an owned copy of the bytes, so the `buf` argument can be
 freed or changed afterwards.
*/

I think it would be helpful to users to mention that this can return NULL in cases of out of memory. Because it can return that then, can't it?

@seanmonstar
Copy link
Member

Yes, you're right! This would be a simple doc change. And in fact the code is already prepared to return NULL on panic. However, it seems there's no progress on the issue to allow setting OOM to panic instead of abort (I recorded my check-in in #2396).

@seanmonstar seanmonstar added A-docs Area: documentation. A-ffi Area: ffi (C API) E-easy Effort: easy. A task that would be a great starting point for a new contributor. labels May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation. A-ffi Area: ffi (C API) E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants