Like rdbSaveRawString() gets a Redis object instead. */
| 482 | |
| 483 | /* Like rdbSaveRawString() gets a Redis object instead. */ |
| 484 | ssize_t rdbSaveStringObject(rio *rdb, robj *obj) { |
| 485 | /* Avoid to decode the object, then encode it again, if the |
| 486 | * object is already integer encoded. */ |
| 487 | if (obj->encoding == OBJ_ENCODING_INT) { |
| 488 | return rdbSaveLongLongAsStringObject(rdb,(long)obj->ptr); |
| 489 | } else { |
| 490 | serverAssertWithInfo(NULL,obj,sdsEncodedObject(obj)); |
| 491 | return rdbSaveRawString(rdb,obj->ptr,sdslen(obj->ptr)); |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | /* Load a string object from an RDB file according to flags: |
| 496 | * |
no test coverage detected