mirror of
https://github.com/phpredis/phpredis.git
synced 2026-06-19 07:35:31 +00:00
Comment debug code, fix compiler warnings
This commit is contained in:
+7
-31
@@ -8,8 +8,7 @@
|
||||
|
||||
extern zend_class_entry *redis_cluster_exception_ce;
|
||||
|
||||
/* Some debug methods that will go away when we're through with them */
|
||||
|
||||
/* Debugging methods/
|
||||
static void cluster_dump_nodes(redisCluster *c) {
|
||||
redisClusterNode **pp, *p;
|
||||
|
||||
@@ -40,7 +39,7 @@ static void cluster_log(char *fmt, ...)
|
||||
fprintf(stderr, "%s\n", buffer);
|
||||
}
|
||||
|
||||
/* Debug function to dump a clusterReply structure recursively */
|
||||
// Debug function to dump a clusterReply structure recursively
|
||||
static void dump_reply(clusterReply *reply, int indent) {
|
||||
smart_str buf = {0};
|
||||
int i;
|
||||
@@ -87,6 +86,8 @@ static void dump_reply(clusterReply *reply, int indent) {
|
||||
efree(buf.c);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* Recursively free our reply object. If free_data is non-zero we'll also free
|
||||
* the payload data (strings) themselves. If not, we just free the structs */
|
||||
@@ -116,7 +117,7 @@ static void
|
||||
cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements,
|
||||
clusterReply **element, int *err TSRMLS_DC)
|
||||
{
|
||||
size_t idx = 0;
|
||||
size_t idx = 0, sz;
|
||||
clusterReply *r;
|
||||
long len;
|
||||
char buf[1024];
|
||||
@@ -137,10 +138,11 @@ cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements,
|
||||
switch(r->type) {
|
||||
case TYPE_ERR:
|
||||
case TYPE_LINE:
|
||||
if(redis_sock_gets(sock,buf,sizeof(buf),&r->len TSRMLS_CC)<0) {
|
||||
if(redis_sock_gets(sock,buf,sizeof(buf),&sz TSRMLS_CC)<0) {
|
||||
*err = 1;
|
||||
return;
|
||||
}
|
||||
r->len = (long long)sz;
|
||||
break;
|
||||
case TYPE_INT:
|
||||
r->integer = len;
|
||||
@@ -582,32 +584,6 @@ unsigned short cluster_hash_key_zval(zval *z_key) {
|
||||
return cluster_hash_key(kptr, klen);
|
||||
}
|
||||
|
||||
static char **split_str_by_delim(char *str, char *delim, int *len) {
|
||||
char **array, *tok, *tok_buf;
|
||||
int size=16;
|
||||
|
||||
*len = 0;
|
||||
|
||||
// Initial storage
|
||||
array = emalloc(size * sizeof(char*));
|
||||
|
||||
tok = php_strtok_r(str, delim, &tok_buf);
|
||||
|
||||
while(tok) {
|
||||
if(size == *len) {
|
||||
size *= 2;
|
||||
array = erealloc(array, size * sizeof(char*));
|
||||
}
|
||||
|
||||
array[*len] = tok;
|
||||
(*len)++;
|
||||
|
||||
tok = php_strtok_r(NULL, delim, &tok_buf);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/* Fisher-Yates shuffle for integer array */
|
||||
static void fyshuffle(int *array, size_t len) {
|
||||
int temp, n = len;
|
||||
|
||||
@@ -78,7 +78,7 @@ static const uint16_t crc16tab[256]= {
|
||||
0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0
|
||||
};
|
||||
|
||||
static uint16_t crc16(const char *buf, int len) {
|
||||
static inline uint16_t crc16(const char *buf, int len) {
|
||||
int counter;
|
||||
uint16_t crc = 0;
|
||||
for (counter = 0; counter < len; counter++)
|
||||
|
||||
+1
-1
@@ -2037,7 +2037,7 @@ PHP_METHOD(RedisCluster, _redir) {
|
||||
size_t len;
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "%s:%d", c->redir_host, c->redir_port);
|
||||
if(c->redir_host && c->redir_host_len) {
|
||||
if(*c->redir_host && c->redir_host_len) {
|
||||
RETURN_STRINGL(buf, len, 1);
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
|
||||
Reference in New Issue
Block a user