diff options
author | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2017-08-01 23:41:48 +0300 |
---|---|---|
committer | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2017-08-16 16:58:10 +0300 |
commit | 2bf7b2f7142f3fc14ba83260c065ef98e6499b8b (patch) | |
tree | 9a2c55f66dd9f4c33f92fc04a5b23ecbc966f541 /cluster_library.h | |
parent | acc84cccb9f590e13a421a87f6fa3c82a1b33ea9 (diff) |
Use zend_string to store strings in RedisSock
Following fields were changed: err, prefix, persistent_id, auth and host
Diffstat (limited to 'cluster_library.h')
-rw-r--r-- | cluster_library.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cluster_library.h b/cluster_library.h index 1b181077..b3abd7e1 100644 --- a/cluster_library.h +++ b/cluster_library.h @@ -48,8 +48,8 @@ /* Compare redirection slot information with what we have */ #define CLUSTER_REDIR_CMP(c) \ (SLOT_SOCK(c,c->redir_slot)->port != c->redir_port || \ - strlen(SLOT_SOCK(c,c->redir_slot)->host) != c->redir_host_len || \ - memcmp(SLOT_SOCK(c,c->redir_slot)->host,c->redir_host,c->redir_host_len)) + ZSTR_LEN(SLOT_SOCK(c,c->redir_slot)->host) != c->redir_host_len || \ + memcmp(ZSTR_VAL(SLOT_SOCK(c,c->redir_slot)->host),c->redir_host,c->redir_host_len)) /* Lazy connect logic */ #define CLUSTER_LAZY_CONNECT(s) \ @@ -59,11 +59,13 @@ } /* Clear out our "last error" */ -#define CLUSTER_CLEAR_ERROR(c) \ - if(c->err) efree(c->err); \ - c->err = NULL; \ - c->err_len = 0; \ - c->clusterdown = 0; +#define CLUSTER_CLEAR_ERROR(c) do { \ + if (c->err) { \ + zend_string_release(c->err); \ + c->err = NULL; \ + } \ + c->clusterdown = 0; \ +} while (0) /* Protected sending of data down the wire to a RedisSock->stream */ #define CLUSTER_SEND_PAYLOAD(sock, buf, len) \ @@ -216,8 +218,7 @@ typedef struct redisCluster { short clusterdown; /* The last ERROR we encountered */ - char *err; - int err_len; + zend_string *err; /* The slot our command is operating on, as well as it's socket */ unsigned short cmd_slot; |