| 646 | } |
| 647 | |
| 648 | int getLongDoubleFromObject(robj *o, long double *target) { |
| 649 | long double value; |
| 650 | |
| 651 | if (o == NULL) { |
| 652 | value = 0; |
| 653 | } else { |
| 654 | serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); |
| 655 | if (sdsEncodedObject(o)) { |
| 656 | if (!string2ld(o->ptr, sdslen(o->ptr), &value)) |
| 657 | return C_ERR; |
| 658 | } else if (o->encoding == OBJ_ENCODING_INT) { |
| 659 | value = (long)o->ptr; |
| 660 | } else { |
| 661 | serverPanic("Unknown string encoding"); |
| 662 | } |
| 663 | } |
| 664 | *target = value; |
| 665 | return C_OK; |
| 666 | } |
| 667 | |
| 668 | int getLongDoubleFromObjectOrReply(client *c, robj *o, long double *target, const char *msg) { |
| 669 | long double value; |
no test coverage detected