.\" Man page generated from reStructuredText. . .TH "BSON_DESTROY_WITH_STEAL" "3" "Jun 04, 2021" "1.17.6" "libbson" .SH NAME bson_destroy_with_steal \- bson_destroy_with_steal() . .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 uint8_t * bson_destroy_with_steal (bson_t *bson, bool steal, uint32_t *length); .ft P .fi .UNINDENT .UNINDENT .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBbson\fP: A \fBbson_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 \fBbson_destroy_with_steal()\fP function shall destroy a \fBbson_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 \fBbson_t\fP that is not a top\-level \fBbson_t\fP, such as those initialized with \fBbson_append_document_begin()\fP, \fBbson_append_array_begin()\fP, and \fBbson_writer_begin()\fP\&. .sp See also \fBbson_steal\fP, a higher\-level function that efficiently transfers the contents of one \fBbson_t\fP to another. .SH RETURNS .sp \fBbson_destroy_with_steal()\fP shall return a buffer containing the contents of the \fBbson_t\fP if \fBsteal\fP is non\-zero. This should be freed with \fBbson_free()\fP when no longer in use. \fBlength\fP will be set to the length of the bson document if non\-NULL. .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .