.\" This manpage is Copyright (C) 2016 MongoDB, Inc. .\" .\" Permission is granted to copy, distribute and/or modify this document .\" under the terms of the GNU Free Documentation License, Version 1.3 .\" or any later version published by the Free Software Foundation; .\" with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. .\" A copy of the license is included in the section entitled "GNU .\" Free Documentation License". .\" .TH "BSON_NEW_FROM_BUFFER" "3" "2016\(hy10\(hy12" "libbson" .SH NAME bson_new_from_buffer() \- Creates a new bson_t using the data provided. .SH "SYNOPSIS" .nf .nf bson_t * bson_new_from_buffer (uint8_t **buf, size_t *buf_len, bson_realloc_func realloc_func, void *realloc_func_ctx); .fi .fi .SH "PARAMETERS" .TP .B buf An out\(hypointer to a buffer containing a serialized BSON document, or to NULL. .LP .TP .B buf_len An out\(hypointer to the length of the buffer in bytes. .LP .TP .B realloc_func Optional .B bson_realloc_func for reallocating the buffer. .LP .TP .B realloc_func_ctx Optional pointer that will be passed as .B ctx to .B realloc_func . .LP .SH "DESCRIPTION" Creates a new .B bson_t using the data provided. The .B realloc_func , if provided, is called to resize .B buf if the document is later expanded, for example by a call to one of the .B bson_append functions. If .B *buf is initially NULL then it is allocated, using .B realloc_func or the default allocator, and initialized with an empty BSON document, and .B *buf_len is set to 5, the size of an empty document. .SH "RETURNS" A newly\(hyallocated .B bson_t on success, or NULL. .B .SH COLOPHON This page is part of libbson. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.