Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Favre-Felix <n.favrefelix@gmail.com>2010-09-19 18:15:10 +0400
committerNicolas Favre-Felix <n.favrefelix@gmail.com>2010-09-19 18:15:10 +0400
commitf031b3c6286adb5edb5c48f9bbb41eb23007ee02 (patch)
treeb0fefc595efdfbb85db933ff37b059263d8bb2d5 /redis.c
parentbc458d9d692ebf826e0cfb029f6754ce11e4333f (diff)
Cleanup.
Diffstat (limited to 'redis.c')
-rwxr-xr-xredis.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/redis.c b/redis.c
index 988f2e08..ea40b2aa 100755
--- a/redis.c
+++ b/redis.c
@@ -784,7 +784,7 @@ PHP_METHOD(Redis, getMultiple)
HashPosition pointer;
RedisSock *redis_sock;
char *cmd = "", *old_cmd = NULL;
- int cmd_len, array_count;
+ int cmd_len = 0, array_count, elements = 1;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa",
&object, redis_ce, &array) == FAILURE) {
@@ -812,16 +812,18 @@ PHP_METHOD(Redis, getMultiple)
if(*cmd) {
old_cmd = cmd;
}
- cmd_len = spprintf(&cmd, 0, "%s %s", cmd, Z_STRVAL_PP(data));
+ cmd_len = redis_cmd_format(&cmd, "%s$%d" _NL "%s" _NL
+ , cmd, cmd_len
+ , Z_STRLEN_PP(data), Z_STRVAL_PP(data), Z_STRLEN_PP(data));
if(old_cmd) {
efree(old_cmd);
}
+ elements++;
}
}
old_cmd = cmd;
- cmd_len = spprintf(&cmd, 0, "MGET %s\r\n", cmd);
-
+ cmd_len = redis_cmd_format(&cmd, "*%d" _NL "$4" _NL "MGET" _NL "%s", elements, cmd, cmd_len);
efree(old_cmd);
REDIS_PROCESS_REQUEST(redis_sock, cmd, cmd_len);