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

Function PgbsonEquals

pg_documentdb_core/src/io/pgbson.c:47–65  ·  view source on GitHub ↗

* Compares to pgbson structures for strict equality: * returns true if they are byte-wise equal. * * Also performs a NULL based equality check */

Source from the content-addressed store, hash-verified

45 * Also performs a NULL based equality check
46 */
47bool
48PgbsonEquals(const pgbson *left, const pgbson *right)
49{
50 if (left == NULL || right == NULL)
51 {
52 if (left == NULL && right == NULL)
53 {
54 return true;
55 }
56 return false;
57 }
58
59 if (VARSIZE_ANY_EXHDR(left) != VARSIZE_ANY_EXHDR(right))
60 {
61 return false;
62 }
63
64 return memcmp(VARDATA_ANY(left), VARDATA_ANY(right), VARSIZE_ANY_EXHDR(left)) == 0;
65}
66
67
68/*

Callers 11

ComparePgbsonQueryFunction · 0.85
ComparePgbsonFunction · 0.85
BsonUpdateDocumentCoreFunction · 0.85
DensifyDocsFromStateFunction · 0.85
ShardCollectionCoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected