1BSON_DESTROY_WITH_STEAL(3) libbson BSON_DESTROY_WITH_STEAL(3)
2
3
4
6 uint8_t *
7 bson_destroy_with_steal (bson_t *bson, bool steal, uint32_t *length);
8
10 • bson: A bson_t.
11
12 • steal: A bool indicating if the underlying buffer should be stolen.
13
14 • length: A location for storing the resulting buffer length.
15
17 The bson_destroy_with_steal() function shall destroy a bson_t structure
18 but return the underlying buffer instead of freeing it. If steal is
19 false, this is equivalent to calling bson_destroy(). It is a program‐
20 ming error to call this function on a bson_t that is not a top-level
21 bson_t, such as those initialized with bson_append_document_begin(),
22 bson_append_array_begin(), and bson_writer_begin().
23
25 bson_destroy_with_steal() shall return a buffer containing the contents
26 of the bson_t if steal is non-zero. This should be freed with
27 bson_free() when no longer in use. length will be set to the length of
28 the bson document if non-NULL.
29
30 SEE ALSO:
31 bson_steal(), a higher-level function that efficiently transfers the contents of one bson_t to another.
32
33
35 MongoDB, Inc
36
38 2017-present, MongoDB, Inc
39
40
41
42
431.25.1 Nov 08, 2023 BSON_DESTROY_WITH_STEAL(3)