MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / equalStringObjects

Function equalStringObjects

src/object.cpp:636–645  ·  view source on GitHub ↗

Equal string objects return 1 if the two objects are the same from the * point of view of a string comparison, otherwise 0 is returned. Note that * this function is faster then checking for (compareStringObject(a,b) == 0) * because it can perform some more optimization. */

Source from the content-addressed store, hash-verified

634 * this function is faster then checking for (compareStringObject(a,b) == 0)
635 * because it can perform some more optimization. */
636int equalStringObjects(robj *a, robj *b) {
637 if (a->encoding == OBJ_ENCODING_INT &&
638 b->encoding == OBJ_ENCODING_INT){
639 /* If both strings are integer encoded just check if the stored
640 * long is the same. */
641 return a->m_ptr == b->m_ptr;
642 } else {
643 return compareStringObjects(a,b) == 0;
644 }
645}
646
647size_t stringObjectLen(robj_roptr o) {
648 serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);

Callers 3

getNodeByQueryFunction · 0.85
watchForKeyFunction · 0.85
listMatchObjectsFunction · 0.85

Calls 1

compareStringObjectsFunction · 0.85

Tested by

no test coverage detected