1BSON_NEW_FROM_BUFFER(3) libbson BSON_NEW_FROM_BUFFER(3)
2
3
4
6 bson_t *
7 bson_new_from_buffer (uint8_t **buf,
8 size_t *buf_len,
9 bson_realloc_func realloc_func,
10 void *realloc_func_ctx);
11
13 • buf: An out-pointer to a buffer containing a serialized BSON docu‐
14 ment, or to NULL.
15
16 • buf_len: An out-pointer to the length of the buffer in bytes.
17
18 • realloc_func: Optional bson_realloc_func for reallocating the buffer.
19
20 • realloc_func_ctx: Optional pointer that will be passed as ctx to re‐
21 alloc_func.
22
24 Creates a new bson_t using the data provided.
25
26 The realloc_func, if provided, is called to resize buf if the document
27 is later expanded, for example by a call to one of the bson_append
28 functions.
29
30 If *buf is initially NULL then it is allocated, using realloc_func or
31 the default allocator, and initialized with an empty BSON document, and
32 *buf_len is set to 5, the size of an empty document.
33
35 A newly-allocated bson_t on success, or NULL.
36
38 MongoDB, Inc
39
41 2017-present, MongoDB, Inc
42
43
44
45
461.25.1 Nov 08, 2023 BSON_NEW_FROM_BUFFER(3)