MCPcopy Create free account
hub / github.com/F-Stack/f-stack / RM_CreateStringFromCallReply

Function RM_CreateStringFromCallReply

app/redis-6.2.6/src/module.c:3946–3959  ·  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

3944/* Return a new string object from a call reply of type string, error or
3945 * integer. Otherwise (wrong reply type) return NULL. */
3946RedisModuleString *RM_CreateStringFromCallReply(RedisModuleCallReply *reply) {
3947 moduleParseCallReply(reply);
3948 switch(reply->type) {
3949 case REDISMODULE_REPLY_STRING:
3950 case REDISMODULE_REPLY_ERROR:
3951 return RM_CreateString(reply->ctx,reply->val.str,reply->len);
3952 case REDISMODULE_REPLY_INTEGER: {
3953 char buf[64];
3954 int len = ll2string(buf,sizeof(buf),reply->val.ll);
3955 return RM_CreateString(reply->ctx,buf,len);
3956 }
3957 default: return NULL;
3958 }
3959}
3960
3961/* Returns an array of robj pointers, and populates *argc with the number
3962 * 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