1BSON_DESTROY_WITH_STEAL(3)          Libbson         BSON_DESTROY_WITH_STEAL(3)
2
3
4

NAME

6       bson_destroy_with_steal - bson_destroy_with_steal()
7

SYNOPSIS

9          uint8_t *
10          bson_destroy_with_steal (bson_t *bson, bool steal, uint32_t *length);
11

PARAMETERS

13       · bson: A bson_t.
14
15       · steal: A bool indicating if the underlying buffer should be stolen.
16
17       · length: A location for storing the resulting buffer length.
18

DESCRIPTION

20       The bson_destroy_with_steal() function shall destroy a bson_t structure
21       but return the underlying buffer instead of freeing  it.  If  steal  is
22       false,  this  is equivalent to calling bson_destroy(). It is a program‐
23       ming error to call this function on a bson_t that is  not  a  top-level
24       bson_t,  such  as  those initialized with bson_append_document_begin(),
25       bson_append_array_begin(), and bson_writer_begin().
26
27       See also bson_steal, a higher-level function that efficiently transfers
28       the contents of one bson_t to another.
29

RETURNS

31       bson_destroy_with_steal() shall return a buffer containing the contents
32       of the  bson_t  if  steal  is  non-zero.  This  should  be  freed  with
33       bson_free()  when no longer in use. length will be set to the length of
34       the bson document if non-NULL.
35

AUTHOR

37       MongoDB, Inc
38
40       2017-present, MongoDB, Inc
41
42
43
44
451.14.0                           Feb 22, 2019       BSON_DESTROY_WITH_STEAL(3)
Impressum