Skip to content

docs(ffi): note that hyper_buf_copy can return NULL on error #2638

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

Merged
merged 1 commit into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions capi/include/hyper.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ void hyper_body_set_data_func(struct hyper_body *body, hyper_body_data_callback

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

This returns `NULL` if allocating a new buffer fails.
*/
struct hyper_buf *hyper_buf_copy(const uint8_t *buf, size_t len);

Expand Down
2 changes: 2 additions & 0 deletions src/ffi/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ ffi_fn! {
///
/// This makes an owned copy of the bytes, so the `buf` argument can be
/// freed or changed afterwards.
///
/// This returns `NULL` if allocating a new buffer fails.
fn hyper_buf_copy(buf: *const u8, len: size_t) -> *mut hyper_buf {
let slice = unsafe {
std::slice::from_raw_parts(buf, len)
Expand Down