Skip to content

Commit 6c377ee

Browse files
committed
added redis array stuff to win part done some fixes to it
1 parent 0303e15 commit 6c377ee

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

config.w32

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG_ENABLE("redis-session", "whether to enable sessions", "yes");
55
ARG_ENABLE("redis-igbinary", "whether to enable igbinary support", "no");
66

77
if (PHP_REDIS != "no") {
8-
var sources = "redis.c library.c"
8+
var sources = "redis.c library.c redis_array.c redis_array_impl.c"
99

1010
if (PHP_REDIS_IGBINARY != "no") {
1111
sources += " igbinary\\igbinary.c igbinary\\hash_si.c igbinary\\hash_function.c";

redis_array.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ PHP_METHOD(RedisArray, __construct)
219219

220220
/* extract options */
221221
if(z_opts) {
222+
zval **z_retry_interval_pp;
223+
zval **z_connect_timeout_pp;
222224

223225
hOpts = Z_ARRVAL_P(z_opts);
224226

@@ -259,7 +261,6 @@ PHP_METHOD(RedisArray, __construct)
259261
}
260262

261263
/* extract retry_interval option. */
262-
zval **z_retry_interval_pp;
263264
if (FAILURE != zend_hash_find(hOpts, "retry_interval", sizeof("retry_interval"), (void**)&z_retry_interval_pp)) {
264265
if (Z_TYPE_PP(z_retry_interval_pp) == IS_LONG || Z_TYPE_PP(z_retry_interval_pp) == IS_STRING) {
265266
if (Z_TYPE_PP(z_retry_interval_pp) == IS_LONG) {
@@ -277,7 +278,6 @@ PHP_METHOD(RedisArray, __construct)
277278
}
278279

279280
/* extract connect_timeout option */
280-
zval **z_connect_timeout_pp;
281281
if (FAILURE != zend_hash_find(hOpts, "connect_timeout", sizeof("connect_timeout"), (void**)&z_connect_timeout_pp)) {
282282
if (Z_TYPE_PP(z_connect_timeout_pp) == IS_DOUBLE || Z_TYPE_PP(z_connect_timeout_pp) == IS_STRING) {
283283
if (Z_TYPE_PP(z_connect_timeout_pp) == IS_DOUBLE) {
@@ -1045,19 +1045,20 @@ PHP_METHOD(RedisArray, mset)
10451045

10461046
/* calls */
10471047
for(n = 0; n < ra->count; ++n) { /* for each node */
1048+
int found = 0;
10481049

10491050
/* prepare call */
10501051
ZVAL_STRING(&z_fun, "MSET", 0);
10511052
redis_inst = ra->redis[n];
10521053

10531054
/* copy args */
1054-
int found = 0;
10551055
MAKE_STD_ZVAL(z_argarray);
10561056
array_init(z_argarray);
10571057
for(i = 0; i < argc; ++i) {
1058+
zval *z_tmp;
1059+
10581060
if(pos[i] != n) continue;
10591061

1060-
zval *z_tmp;
10611062
ALLOC_ZVAL(z_tmp);
10621063
*z_tmp = *argv[i];
10631064
zval_copy_ctor(z_tmp);

redis_array_impl.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -469,12 +469,14 @@ ra_find_node(RedisArray *ra, const char *key, int key_len, int *out_pos TSRMLS_D
469469
}
470470
}
471471
else {
472+
uint64_t h64;
473+
472474
/* hash */
473475
hash = rcrc32(out, out_len);
474476
efree(out);
475477

476478
/* get position on ring */
477-
uint64_t h64 = hash;
479+
h64 = hash;
478480
h64 *= ra->count;
479481
h64 /= 0xffffffff;
480482
pos = (int)h64;
@@ -569,13 +571,14 @@ ra_index_keys(zval *z_pairs, zval *z_redis TSRMLS_DC) {
569571

570572
/* Initialize key array */
571573
zval *z_keys, **z_entry_pp;
574+
HashPosition pos;
575+
572576
MAKE_STD_ZVAL(z_keys);
573577
#if PHP_VERSION_ID > 50300
574578
array_init_size(z_keys, zend_hash_num_elements(Z_ARRVAL_P(z_pairs)));
575579
#else
576580
array_init(z_keys);
577581
#endif
578-
HashPosition pos;
579582

580583
/* Go through input array and add values to the key array */
581584
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(z_pairs), &pos);

redis_array_impl.h

+5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#ifndef REDIS_ARRAY_IMPL_H
22
#define REDIS_ARRAY_IMPL_H
33

4+
#ifdef PHP_WIN32
5+
#include "win32/php_stdint.h"
6+
#else
47
#include <stdint.h>
8+
#endif
9+
#include "common.h"
510
#include "common.h"
611
#include "redis_array.h"
712

0 commit comments

Comments
 (0)