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

Function clusterManagerCheckRedisReply

app/redis-6.2.6/src/redis-cli.c:2763–2777  ·  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

2761 * of reply error (it's up to the caller function to free it), elsewhere
2762 * the error is directly printed. */
2763static int clusterManagerCheckRedisReply(clusterManagerNode *n,
2764 redisReply *r, char **err)
2765{
2766 int is_err = 0;
2767 if (!r || (is_err = (r->type == REDIS_REPLY_ERROR))) {
2768 if (is_err) {
2769 if (err != NULL) {
2770 *err = zmalloc((r->len + 1) * sizeof(char));
2771 strcpy(*err, r->str);
2772 } else CLUSTER_MANAGER_PRINT_REPLY_ERROR(n, r->str);
2773 }
2774 return 0;
2775 }
2776 return 1;
2777}
2778
2779/* Call MULTI command on a cluster node. */
2780static int clusterManagerStartTransaction(clusterManagerNode *node) {

Calls 1

zmallocFunction · 0.85

Tested by

no test coverage detected