MCPcopy Create free account
hub / github.com/documentdb/documentdb / CreatePgbsonfromBsonBytes

Function CreatePgbsonfromBsonBytes

pg_documentdb_core/src/io/pgbson.c:1831–1839  ·  view source on GitHub ↗

* Creates a pgbson structure from a raw buffer of bytes */

Source from the content-addressed store, hash-verified

1829 * Creates a pgbson structure from a raw buffer of bytes
1830 */
1831pgbson *
1832CreatePgbsonfromBsonBytes(const uint8_t *rawbytes, uint32_t length)
1833{
1834 int bson_size = length + VARHDRSZ;
1835 pgbson *pgbsonVal = (pgbson *) palloc(bson_size);
1836 SET_VARSIZE(pgbsonVal, bson_size);
1837 memcpy(VARDATA(pgbsonVal), rawbytes, length);
1838 return pgbsonVal;
1839}
1840
1841
1842/*

Callers 3

PgbsonInitFromBufferFunction · 0.85
PgbsonCloneFromPgbsonFunction · 0.85
CreatePgbsonfromBson_tFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected