diff --git a/config.w32 b/config.w32 index 9600f68..b8f99d3 100644 --- a/config.w32 +++ b/config.w32 @@ -5,7 +5,7 @@ ARG_ENABLE("redis-session", "whether to enable sessions", "yes"); ARG_ENABLE("redis-igbinary", "whether to enable igbinary support", "no"); if (PHP_REDIS != "no") { - var sources = "redis.c library.c" + var sources = "redis.c library.c redis_array.c redis_array_impl.c" if (PHP_REDIS_IGBINARY != "no") { sources += " igbinary\\igbinary.c igbinary\\hash_si.c igbinary\\hash_function.c"; diff --git a/redis_array.c b/redis_array.c index 36254df..fc9ded5 100644 --- a/redis_array.c +++ b/redis_array.c @@ -219,6 +219,8 @@ PHP_METHOD(RedisArray, __construct) /* extract options */ if(z_opts) { + zval **z_retry_interval_pp; + zval **z_connect_timeout_pp; hOpts = Z_ARRVAL_P(z_opts); @@ -259,7 +261,6 @@ PHP_METHOD(RedisArray, __construct) } /* extract retry_interval option. */ - zval **z_retry_interval_pp; if (FAILURE != zend_hash_find(hOpts, "retry_interval", sizeof("retry_interval"), (void**)&z_retry_interval_pp)) { if (Z_TYPE_PP(z_retry_interval_pp) == IS_LONG || Z_TYPE_PP(z_retry_interval_pp) == IS_STRING) { if (Z_TYPE_PP(z_retry_interval_pp) == IS_LONG) { @@ -277,7 +278,6 @@ PHP_METHOD(RedisArray, __construct) } /* extract connect_timeout option */ - zval **z_connect_timeout_pp; if (FAILURE != zend_hash_find(hOpts, "connect_timeout", sizeof("connect_timeout"), (void**)&z_connect_timeout_pp)) { if (Z_TYPE_PP(z_connect_timeout_pp) == IS_DOUBLE || Z_TYPE_PP(z_connect_timeout_pp) == IS_STRING) { if (Z_TYPE_PP(z_connect_timeout_pp) == IS_DOUBLE) { @@ -1045,19 +1045,20 @@ PHP_METHOD(RedisArray, mset) /* calls */ for(n = 0; n < ra->count; ++n) { /* for each node */ + int found = 0; /* prepare call */ ZVAL_STRING(&z_fun, "MSET", 0); redis_inst = ra->redis[n]; /* copy args */ - int found = 0; MAKE_STD_ZVAL(z_argarray); array_init(z_argarray); for(i = 0; i < argc; ++i) { + zval *z_tmp; + if(pos[i] != n) continue; - zval *z_tmp; ALLOC_ZVAL(z_tmp); *z_tmp = *argv[i]; zval_copy_ctor(z_tmp); diff --git a/redis_array_impl.c b/redis_array_impl.c index 615f503..eb09362 100644 --- a/redis_array_impl.c +++ b/redis_array_impl.c @@ -469,12 +469,14 @@ ra_find_node(RedisArray *ra, const char *key, int key_len, int *out_pos TSRMLS_D } } else { + uint64_t h64; + /* hash */ hash = rcrc32(out, out_len); efree(out); /* get position on ring */ - uint64_t h64 = hash; + h64 = hash; h64 *= ra->count; h64 /= 0xffffffff; pos = (int)h64; @@ -569,13 +571,14 @@ ra_index_keys(zval *z_pairs, zval *z_redis TSRMLS_DC) { /* Initialize key array */ zval *z_keys, **z_entry_pp; + HashPosition pos; + MAKE_STD_ZVAL(z_keys); #if PHP_VERSION_ID > 50300 array_init_size(z_keys, zend_hash_num_elements(Z_ARRVAL_P(z_pairs))); #else array_init(z_keys); #endif - HashPosition pos; /* Go through input array and add values to the key array */ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(z_pairs), &pos); diff --git a/redis_array_impl.h b/redis_array_impl.h index 4c2a1b0..d12844d 100644 --- a/redis_array_impl.h +++ b/redis_array_impl.h @@ -1,7 +1,12 @@ #ifndef REDIS_ARRAY_IMPL_H #define REDIS_ARRAY_IMPL_H +#ifdef PHP_WIN32 +#include "win32/php_stdint.h" +#else #include +#endif +#include "common.h" #include "common.h" #include "redis_array.h"