MCPcopy Create free account
hub / github.com/F-Stack/f-stack / getDoubleFromObject

Function getDoubleFromObject

app/redis-6.2.6/src/object.c:614–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

612}
613
614int getDoubleFromObject(const robj *o, double *target) {
615 double value;
616
617 if (o == NULL) {
618 value = 0;
619 } else {
620 serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);
621 if (sdsEncodedObject(o)) {
622 if (!string2d(o->ptr, sdslen(o->ptr), &value))
623 return C_ERR;
624 } else if (o->encoding == OBJ_ENCODING_INT) {
625 value = (long)o->ptr;
626 } else {
627 serverPanic("Unknown string encoding");
628 }
629 }
630 *target = value;
631 return C_OK;
632}
633
634int getDoubleFromObjectOrReply(client *c, robj *o, double *target, const char *msg) {
635 double value;

Callers 2

RM_StringToDoubleFunction · 0.85

Calls 2

string2dFunction · 0.85
sdslenFunction · 0.85

Tested by

no test coverage detected