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

Function CopyPgbsonIntoMemoryContext

pg_documentdb_core/src/io/pgbson.c:1846–1853  ·  view source on GitHub ↗

* CopyPgbsonIntoMemoryContext can be used to copy a pgbson into a * long-lived memory context. */

Source from the content-addressed store, hash-verified

1844 * long-lived memory context.
1845 */
1846pgbson *
1847CopyPgbsonIntoMemoryContext(const pgbson *document, MemoryContext context)
1848{
1849 pgbson *copiedDoc = MemoryContextAlloc(context, VARSIZE_ANY(document));
1850 memcpy(copiedDoc, document, VARSIZE_ANY(document));
1851
1852 return copiedDoc;
1853}
1854
1855
1856/*

Calls

no outgoing calls

Tested by

no test coverage detected