1BSON_DESTROY_WITH_STEAL(3) libbson BSON_DESTROY_WITH_STEAL(3)
2
3
4
6 bson_destroy_with_steal - bson_destroy_with_steal()
7
9 uint8_t *
10 bson_destroy_with_steal (bson_t *bson, bool steal, uint32_t *length);
11
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
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
28 bson_destroy_with_steal() shall return a buffer containing the contents
29 of the bson_t if steal is non-zero. This should be freed with
30 bson_free() when no longer in use. length will be set to the length of
31 the bson document if non-NULL.
32
33 SEE ALSO:
34 bson_steal(), a higher-level function that efficiently transfers the contents of one bson_t to another.
35
36
38 MongoDB, Inc
39
41 2017-present, MongoDB, Inc
42
43
44
45
461.24.3 Aug 17, 2023 BSON_DESTROY_WITH_STEAL(3)