diff options
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | cluster_library.c | 32 | ||||
-rw-r--r-- | library.c | 28 | ||||
-rw-r--r-- | php_redis.h | 2 | ||||
-rw-r--r-- | redis_cluster.c | 3 |
5 files changed, 29 insertions, 38 deletions
diff --git a/.travis.yml b/.travis.yml index ba8f957a..75c63e4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,6 @@ php: - nightly matrix: allow_failures: - - php: 7.0 - - php: 7.1 - php: nightly before_install: phpize install: ./configure CFLAGS=-Wall --prefix=/usr && sudo make install diff --git a/cluster_library.c b/cluster_library.c index 0f2f9583..8ac9971f 100644 --- a/cluster_library.c +++ b/cluster_library.c @@ -118,14 +118,14 @@ static void cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements, clusterReply **element, int *err TSRMLS_DC) { - size_t idx = 0, sz; + int i; + size_t sz; clusterReply *r; long len; char buf[1024]; - while(elements-- > 0) { - element[idx] = ecalloc(1, sizeof(clusterReply)); - r = element[idx]; + for (i = 0; i < elements; i++) { + r = element[i] = ecalloc(1, sizeof(clusterReply)); // Bomb out, flag error condition on a communication failure if(redis_read_reply_type(sock, &r->type, &len TSRMLS_CC)<0) { @@ -158,7 +158,7 @@ cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements, } break; case TYPE_MULTIBULK: - r->element = ecalloc(r->len,r->len*sizeof(clusterReply*)); + r->element = ecalloc(r->len,sizeof(clusterReply*)); r->elements = r->len; cluster_multibulk_resp_recursive(sock, r->elements, r->element, err TSRMLS_CC); @@ -168,8 +168,6 @@ cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements, *err = 1; return; } - - idx++; } } @@ -2032,7 +2030,7 @@ PHP_REDIS_API void cluster_info_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster // Return our array if(CLUSTER_IS_ATOMIC(c)) { - RETVAL_ZVAL(z_result, 0, 1); + RETVAL_ZVAL(z_result, 1, 0); } else { add_next_index_zval(&c->multi_resp, z_result); } @@ -2341,7 +2339,10 @@ int mbulk_resp_loop(RedisSock *redis_sock, zval *z_result, line = redis_sock_read(redis_sock, &line_len TSRMLS_CC); if (line != NULL) { - zval *z = NULL; + zval zv, *z = &zv; +#if (PHP_MAJOR_VERSION < 7) + z = NULL; +#endif if(redis_unserialize(redis_sock, line, line_len, &z TSRMLS_CC)==1) { add_next_index_zval(z_result, z); } else { @@ -2382,7 +2383,10 @@ int mbulk_resp_loop_zipstr(RedisSock *redis_sock, zval *z_result, key_len = line_len; } else { /* Attempt serialization */ - zval *z = NULL; + zval zv, *z = &zv; +#if (PHP_MAJOR_VERSION < 7) + z = NULL; +#endif if(redis_unserialize(redis_sock, line, line_len, &z TSRMLS_CC)==1) { add_assoc_zval(z_result, key, z); } else { @@ -2417,12 +2421,11 @@ int mbulk_resp_loop_zipdbl(RedisSock *redis_sock, zval *z_result, key = line; key_len = line_len; } else { - zval *z = NULL; + zval zv, *z = &zv; if (redis_unserialize(redis_sock,key,key_len, &z TSRMLS_CC)) { convert_to_string(z); add_assoc_double_ex(z_result, Z_STRVAL_P(z), Z_STRLEN_P(z), atof(line)); zval_dtor(z); - efree(z); } else { add_assoc_double_ex(z_result, key, key_len, atof(line)); } @@ -2450,7 +2453,10 @@ int mbulk_resp_loop_assoc(RedisSock *redis_sock, zval *z_result, line = redis_sock_read(redis_sock, &line_len TSRMLS_CC); if(line != NULL) { - zval *z = NULL; + zval zv, *z = &zv; +#if (PHP_MAJOR_VERSION < 7) + z = NULL; +#endif if(redis_unserialize(redis_sock, line, line_len, &z TSRMLS_CC)==1) { add_assoc_zval_ex(z_result,Z_STRVAL(z_keys[i]), Z_STRLEN(z_keys[i]), z); @@ -975,11 +975,9 @@ PHP_REDIS_API void redis_client_list_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSo RETURN_FALSE; } + zval zv, *z_ret = &zv; #if (PHP_MAJOR_VERSION < 7) - zval *z_ret; MAKE_STD_ZVAL(z_ret); -#else - zval zv, *z_ret = &zv; #endif /* Parse it out */ @@ -1287,11 +1285,9 @@ redis_mbulk_reply_zipped(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, return -1; } numElems = atoi(inbuf+1); + zval zv, *z_multi_result = &zv; #if (PHP_MAJOR_VERSION < 7) - zval *z_multi_result; MAKE_STD_ZVAL(z_multi_result); -#else - zval zv, *z_multi_result = &zv; #endif array_init(z_multi_result); /* pre-allocate array for multi's results. */ @@ -1456,11 +1452,9 @@ PHP_REDIS_API void redis_debug_response(INTERNAL_FUNCTION_PARAMETERS, RedisSock RETURN_FALSE; } + zval zv, *z_result = &zv; #if (PHP_MAJOR_VERSION < 7) - zval *z_result; MAKE_STD_ZVAL(z_result); -#else - zval zv, *z_result = &zv; #endif array_init(z_result); @@ -1783,11 +1777,9 @@ PHP_REDIS_API int redis_sock_read_multibulk_reply(INTERNAL_FUNCTION_PARAMETERS, return -1; } numElems = atoi(inbuf+1); + zval zv, *z_multi_result = &zv; #if (PHP_MAJOR_VERSION < 7) - zval *z_multi_result; MAKE_STD_ZVAL(z_multi_result); -#else - zval zv, *z_multi_result = &zv; #endif array_init(z_multi_result); /* pre-allocate array for multi's results. */ @@ -1832,11 +1824,9 @@ PHP_REDIS_API int redis_mbulk_reply_raw(INTERNAL_FUNCTION_PARAMETERS, RedisSock return -1; } numElems = atoi(inbuf+1); + zval zv, *z_multi_result = &zv; #if (PHP_MAJOR_VERSION < 7) - zval *z_multi_result; MAKE_STD_ZVAL(z_multi_result); -#else - zval zv, *z_multi_result = &zv; #endif array_init(z_multi_result); /* pre-allocate array for multi's results. */ @@ -1917,11 +1907,9 @@ PHP_REDIS_API int redis_mbulk_reply_assoc(INTERNAL_FUNCTION_PARAMETERS, RedisSoc return -1; } numElems = atoi(inbuf+1); + zval zv, *z_multi_result = &zv; #if (PHP_MAJOR_VERSION < 7) - zval *z_multi_result; MAKE_STD_ZVAL(z_multi_result); -#else - zval zv, *z_multi_result = &zv; #endif array_init(z_multi_result); /* pre-allocate array for multi's results. */ @@ -2371,11 +2359,9 @@ redis_read_variant_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, return -1; } + zval zv, *z_ret = &zv; #if (PHP_MAJOR_VERSION < 7) - zval *z_ret; MAKE_STD_ZVAL(z_ret); -#else - zval zv, *z_ret = &zv; #endif /* Switch based on our top level reply type */ switch(reply_type) { diff --git a/php_redis.h b/php_redis.h index b3cd4c9a..01e71ed0 100644 --- a/php_redis.h +++ b/php_redis.h @@ -25,7 +25,7 @@ #define PHP_REDIS_H /* phpredis version */ -#define PHP_REDIS_VERSION "2.2.8-rc1" +#define PHP_REDIS_VERSION "3.1.0-rc1" PHP_METHOD(Redis, __construct); PHP_METHOD(Redis, __destruct); diff --git a/redis_cluster.c b/redis_cluster.c index 1c43f6f6..e4622b94 100644 --- a/redis_cluster.c +++ b/redis_cluster.c @@ -2711,7 +2711,8 @@ PHP_METHOD(RedisCluster, info) { redisCluster *c = GET_CONTEXT(); REDIS_REPLY_TYPE rtype; char *cmd, *opt=NULL; - int cmd_len, opt_len; + int cmd_len; + size_t opt_len; void *ctx = NULL; zval *z_arg; short slot; |