.\" Man page generated from reStructuredText. . .TH "BSON_NEW_FROM_BUFFER" "3" "Jun 04, 2021" "1.17.6" "libbson" .SH NAME bson_new_from_buffer \- bson_new_from_buffer() . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C bson_t * bson_new_from_buffer (uint8_t **buf, size_t *buf_len, bson_realloc_func realloc_func, void *realloc_func_ctx); .ft P .fi .UNINDENT .UNINDENT .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBbuf\fP: An out\-pointer to a buffer containing a serialized BSON document, or to NULL. .IP \(bu 2 \fBbuf_len\fP: An out\-pointer to the length of the buffer in bytes. .IP \(bu 2 \fBrealloc_func\fP: Optional \fBbson_realloc_func\fP for reallocating the buffer. .IP \(bu 2 \fBrealloc_func_ctx\fP: Optional pointer that will be passed as \fBctx\fP to \fBrealloc_func\fP\&. .UNINDENT .SH DESCRIPTION .sp Creates a new \fBbson_t\fP using the data provided. .sp The \fBrealloc_func\fP, if provided, is called to resize \fBbuf\fP if the document is later expanded, for example by a call to one of the \fBbson_append\fP functions. .sp If \fB*buf\fP is initially NULL then it is allocated, using \fBrealloc_func\fP or the default allocator, and initialized with an empty BSON document, and \fB*buf_len\fP is set to 5, the size of an empty document. .SH RETURNS .sp A newly\-allocated \fBbson_t\fP on success, or NULL. .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .