Create a copy of a module type value using the copy callback. If failed * or not supported, produce an error reply and return NULL. */
| 4488 | * or not supported, produce an error reply and return NULL. |
| 4489 | */ |
| 4490 | robj *moduleTypeDupOrReply(client *c, robj *fromkey, robj *tokey, robj *value) { |
| 4491 | moduleValue *mv = (moduleValue*)ptrFromObj(value); |
| 4492 | moduleType *mt = mv->type; |
| 4493 | if (!mt->copy) { |
| 4494 | addReplyError(c, "not supported for this module key"); |
| 4495 | return NULL; |
| 4496 | } |
| 4497 | void *newval = mt->copy(fromkey, tokey, mv->value); |
| 4498 | if (!newval) { |
| 4499 | addReplyError(c, "module key failed to copy"); |
| 4500 | return NULL; |
| 4501 | } |
| 4502 | return createModuleObject(mt, newval); |
| 4503 | } |
| 4504 | |
| 4505 | /* Register a new data type exported by the module. The parameters are the |
| 4506 | * following. Please for in depth documentation check the modules API |
no test coverage detected