| 680 | } |
| 681 | |
| 682 | int getLongLongFromObject(robj *o, long long *target) { |
| 683 | long long value; |
| 684 | |
| 685 | if (o == NULL) { |
| 686 | value = 0; |
| 687 | } else { |
| 688 | serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); |
| 689 | if (sdsEncodedObject(o)) { |
| 690 | if (string2ll(o->ptr,sdslen(o->ptr),&value) == 0) return C_ERR; |
| 691 | } else if (o->encoding == OBJ_ENCODING_INT) { |
| 692 | value = (long)o->ptr; |
| 693 | } else { |
| 694 | serverPanic("Unknown string encoding"); |
| 695 | } |
| 696 | } |
| 697 | if (target) *target = value; |
| 698 | return C_OK; |
| 699 | } |
| 700 | |
| 701 | int getLongLongFromObjectOrReply(client *c, robj *o, long long *target, const char *msg) { |
| 702 | long long value; |
no test coverage detected