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