Delegate writing an object to writing a bulk string or bulk long long. * This is not placed in rio.c since that adds the g_pserver->h dependency. */
| 1076 | /* Delegate writing an object to writing a bulk string or bulk long long. |
| 1077 | * This is not placed in rio.c since that adds the g_pserver->h dependency. */ |
| 1078 | int rioWriteBulkObject(rio *r, robj *obj) { |
| 1079 | /* Avoid using getDecodedObject to help copy-on-write (we are often |
| 1080 | * in a child process when this function is called). */ |
| 1081 | if (obj->encoding == OBJ_ENCODING_INT) { |
| 1082 | return rioWriteBulkLongLong(r,(long)obj->m_ptr); |
| 1083 | } else if (sdsEncodedObject(obj)) { |
| 1084 | return rioWriteBulkString(r,szFromObj(obj),sdslen(szFromObj(obj))); |
| 1085 | } else { |
| 1086 | serverPanic("Unknown string encoding"); |
| 1087 | } |
| 1088 | } |
| 1089 | |
| 1090 | /* Emit the commands needed to rebuild a list object. |
| 1091 | * The function returns 0 on error, 1 on success. */ |
no test coverage detected