Delegate writing an object to writing a bulk string or bulk long long. * This is not placed in rio.c since that adds the server.h dependency. */
| 977 | /* Delegate writing an object to writing a bulk string or bulk long long. |
| 978 | * This is not placed in rio.c since that adds the server.h dependency. */ |
| 979 | int rioWriteBulkObject(rio *r, robj *obj) { |
| 980 | /* Avoid using getDecodedObject to help copy-on-write (we are often |
| 981 | * in a child process when this function is called). */ |
| 982 | if (obj->encoding == OBJ_ENCODING_INT) { |
| 983 | return rioWriteBulkLongLong(r,(long)obj->ptr); |
| 984 | } else if (sdsEncodedObject(obj)) { |
| 985 | return rioWriteBulkString(r,obj->ptr,sdslen(obj->ptr)); |
| 986 | } else { |
| 987 | serverPanic("Unknown string encoding"); |
| 988 | } |
| 989 | } |
| 990 | |
| 991 | /* Emit the commands needed to rebuild a list object. |
| 992 | * The function returns 0 on error, 1 on success. */ |
no test coverage detected