.\" Man page generated from reStructuredText. . . .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 .. .TH "BSON_DESTROY_WITH_STEAL" "3" "Apr 02, 2024" "1.26.2" "libbson" .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX uint8_t * bson_destroy_with_steal (bson_t *bson, bool steal, uint32_t *length); .EE .UNINDENT .UNINDENT .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBbson\fP: A \fI\%bson_t\fP\&. .IP \(bu 2 \fBsteal\fP: A bool indicating if the underlying buffer should be stolen. .IP \(bu 2 \fBlength\fP: A location for storing the resulting buffer length. .UNINDENT .SH DESCRIPTION .sp The \fI\%bson_destroy_with_steal()\fP function shall destroy a \fI\%bson_t\fP structure but return the underlying buffer instead of freeing it. If steal is false, this is equivalent to calling bson_destroy(). It is a programming error to call this function on a \fI\%bson_t\fP that is not a top\-level \fI\%bson_t\fP, such as those initialized with \fI\%bson_append_document_begin()\fP, \fI\%bson_append_array_begin()\fP, and \fI\%bson_writer_begin()\fP\&. .SH RETURNS .sp \fI\%bson_destroy_with_steal()\fP shall return a buffer containing the contents of the \fI\%bson_t\fP if \fBsteal\fP is non\-zero. This should be freed with \fI\%bson_free()\fP when no longer in use. \fBlength\fP will be set to the length of the bson document if non\-NULL. .sp \fBSEE ALSO:\fP .INDENT 0.0 .INDENT 3.5 .nf \fI\%bson_steal()\fP, a higher\-level function that efficiently transfers the contents of one \fI\%bson_t\fP to another. .fi .sp .UNINDENT .UNINDENT .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .