MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / RM_CreateStringFromCallReply

Function RM_CreateStringFromCallReply

src/module.cpp:4034–4047  ·  view source on GitHub ↗

Return a new string object from a call reply of type string, error or * integer. Otherwise (wrong reply type) return NULL. */

Source from the content-addressed store, hash-verified

4032/* Return a new string object from a call reply of type string, error or
4033 * integer. Otherwise (wrong reply type) return NULL. */
4034RedisModuleString *RM_CreateStringFromCallReply(RedisModuleCallReply *reply) {
4035 moduleParseCallReply(reply);
4036 switch(reply->type) {
4037 case REDISMODULE_REPLY_STRING:
4038 case REDISMODULE_REPLY_ERROR:
4039 return RM_CreateString(reply->ctx,reply->val.str,reply->len);
4040 case REDISMODULE_REPLY_INTEGER: {
4041 char buf[64];
4042 int len = ll2string(buf,sizeof(buf),reply->val.ll);
4043 return RM_CreateString(reply->ctx,buf,len);
4044 }
4045 default: return NULL;
4046 }
4047}
4048
4049/* Returns an array of robj pointers, and populates *argc with the number
4050 * of items, by parsing the format specifier "fmt" as described for

Callers

nothing calls this directly

Calls 3

moduleParseCallReplyFunction · 0.85
RM_CreateStringFunction · 0.85
ll2stringFunction · 0.85

Tested by

no test coverage detected