Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3fb843

Browse files
Comment debug code, fix compiler warnings
1 parent ed1da64 commit e3fb843

File tree

3 files changed

+9
-33
lines changed

3 files changed

+9
-33
lines changed

cluster_library.c

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
extern zend_class_entry *redis_cluster_exception_ce;
1010

11-
/* Some debug methods that will go away when we're through with them */
12-
11+
/* Debugging methods/
1312
static void cluster_dump_nodes(redisCluster *c) {
1413
redisClusterNode **pp, *p;
1514
@@ -40,7 +39,7 @@ static void cluster_log(char *fmt, ...)
4039
fprintf(stderr, "%s\n", buffer);
4140
}
4241
43-
/* Debug function to dump a clusterReply structure recursively */
42+
// Debug function to dump a clusterReply structure recursively
4443
static void dump_reply(clusterReply *reply, int indent) {
4544
smart_str buf = {0};
4645
int i;
@@ -87,6 +86,8 @@ static void dump_reply(clusterReply *reply, int indent) {
8786
efree(buf.c);
8887
}
8988
}
89+
*/
90+
9091

9192
/* Recursively free our reply object. If free_data is non-zero we'll also free
9293
* the payload data (strings) themselves. If not, we just free the structs */
@@ -116,7 +117,7 @@ static void
116117
cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements,
117118
clusterReply **element, int *err TSRMLS_DC)
118119
{
119-
size_t idx = 0;
120+
size_t idx = 0, sz;
120121
clusterReply *r;
121122
long len;
122123
char buf[1024];
@@ -137,10 +138,11 @@ cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements,
137138
switch(r->type) {
138139
case TYPE_ERR:
139140
case TYPE_LINE:
140-
if(redis_sock_gets(sock,buf,sizeof(buf),&r->len TSRMLS_CC)<0) {
141+
if(redis_sock_gets(sock,buf,sizeof(buf),&sz TSRMLS_CC)<0) {
141142
*err = 1;
142143
return;
143144
}
145+
r->len = (long long)sz;
144146
break;
145147
case TYPE_INT:
146148
r->integer = len;
@@ -582,32 +584,6 @@ unsigned short cluster_hash_key_zval(zval *z_key) {
582584
return cluster_hash_key(kptr, klen);
583585
}
584586

585-
static char **split_str_by_delim(char *str, char *delim, int *len) {
586-
char **array, *tok, *tok_buf;
587-
int size=16;
588-
589-
*len = 0;
590-
591-
// Initial storage
592-
array = emalloc(size * sizeof(char*));
593-
594-
tok = php_strtok_r(str, delim, &tok_buf);
595-
596-
while(tok) {
597-
if(size == *len) {
598-
size *= 2;
599-
array = erealloc(array, size * sizeof(char*));
600-
}
601-
602-
array[*len] = tok;
603-
(*len)++;
604-
605-
tok = php_strtok_r(NULL, delim, &tok_buf);
606-
}
607-
608-
return array;
609-
}
610-
611587
/* Fisher-Yates shuffle for integer array */
612588
static void fyshuffle(int *array, size_t len) {
613589
int temp, n = len;

crc16.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static const uint16_t crc16tab[256]= {
7878
0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0
7979
};
8080

81-
static uint16_t crc16(const char *buf, int len) {
81+
static inline uint16_t crc16(const char *buf, int len) {
8282
int counter;
8383
uint16_t crc = 0;
8484
for (counter = 0; counter < len; counter++)

redis_cluster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,7 @@ PHP_METHOD(RedisCluster, _redir) {
20372037
size_t len;
20382038

20392039
len = snprintf(buf, sizeof(buf), "%s:%d", c->redir_host, c->redir_port);
2040-
if(c->redir_host && c->redir_host_len) {
2040+
if(*c->redir_host && c->redir_host_len) {
20412041
RETURN_STRINGL(buf, len, 1);
20422042
} else {
20432043
RETURN_NULL();

0 commit comments

Comments
 (0)