| 722 | } |
| 723 | |
| 724 | int getLongLongFromObject(robj *o, long long *target) { |
| 725 | long long value; |
| 726 | |
| 727 | if (o == NULL) { |
| 728 | value = 0; |
| 729 | } else { |
| 730 | serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); |
| 731 | if (sdsEncodedObject(o)) { |
| 732 | if (string2ll(szFromObj(o),sdslen(szFromObj(o)),&value) == 0) return C_ERR; |
| 733 | } else if (o->encoding == OBJ_ENCODING_INT) { |
| 734 | value = (long)ptrFromObj(o); |
| 735 | } else { |
| 736 | serverPanic("Unknown string encoding"); |
| 737 | } |
| 738 | } |
| 739 | if (target) *target = value; |
| 740 | return C_OK; |
| 741 | } |
| 742 | |
| 743 | int getUnsignedLongLongFromObject(robj *o, uint64_t *target) { |
| 744 | uint64_t value; |
no test coverage detected