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

Function getLongDoubleFromObject

src/object.cpp:690–708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

688}
689
690int getLongDoubleFromObject(robj *o, long double *target) {
691 long double value;
692
693 if (o == NULL) {
694 value = 0;
695 } else {
696 serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);
697 if (sdsEncodedObject(o)) {
698 if (!string2ld(szFromObj(o), sdslen(szFromObj(o)), &value))
699 return C_ERR;
700 } else if (o->encoding == OBJ_ENCODING_INT) {
701 value = (long)szFromObj(o);
702 } else {
703 serverPanic("Unknown string encoding");
704 }
705 }
706 *target = value;
707 return C_OK;
708}
709
710int getLongDoubleFromObjectOrReply(client *c, robj *o, long double *target, const char *msg) {
711 long double value;

Callers 1

Calls 3

string2ldFunction · 0.85
szFromObjFunction · 0.85
sdslenFunction · 0.85

Tested by

no test coverage detected