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

Function clusterManagerCheckRedisReply

src/redis-cli.c:2471–2485  ·  view source on GitHub ↗

Check whether reply is NULL or its type is REDIS_REPLY_ERROR. In the * latest case, if the 'err' arg is not NULL, it gets allocated with a copy * of reply error (it's up to the caller function to free it), elsewhere * the error is directly printed. */

Source from the content-addressed store, hash-verified

2469 * of reply error (it's up to the caller function to free it), elsewhere
2470 * the error is directly printed. */
2471int clusterManagerCheckRedisReply(clusterManagerNode *n,
2472 redisReply *r, char **err)
2473{
2474 int is_err = 0;
2475 if (!r || (is_err = (r->type == REDIS_REPLY_ERROR))) {
2476 if (is_err) {
2477 if (err != NULL) {
2478 *err = zmalloc((r->len + 1) * sizeof(char), MALLOC_LOCAL);
2479 strcpy(*err, r->str);
2480 } else CLUSTER_MANAGER_PRINT_REPLY_ERROR(n, r->str);
2481 }
2482 return 0;
2483 }
2484 return 1;
2485}
2486
2487/* Call MULTI command on a cluster node. */
2488static int clusterManagerStartTransaction(clusterManagerNode *node) {

Calls 1

zmallocFunction · 0.85

Tested by

no test coverage detected