diff options
author | Nicolas Favre-Felix <n.favrefelix@gmail.com> | 2012-04-09 13:31:09 +0400 |
---|---|---|
committer | Nicolas Favre-Felix <n.favrefelix@gmail.com> | 2012-04-09 13:34:22 +0400 |
commit | 438dbe3426e08bd50562ea8c370f5424012cf4bc (patch) | |
tree | 31e58e7609eb36578889526a8e3f6f8d89bb915d | |
parent | d717e142cda544cdd825c739a9bf90eb503d4c12 (diff) | |
parent | 80767ee31440c8b16d0e1c7ad9ae43658cbb3ba2 (diff) |
Merge branch 'master' into michael-grunder-master
-rwxr-xr-x | redis.c | 31 | ||||
-rw-r--r-- | tests/TestRedis.php | 9 |
2 files changed, 20 insertions, 20 deletions
@@ -283,37 +283,32 @@ PHPAPI zend_class_entry *redis_get_exception_base(int root TSRMLS_DC) } /** - * Send a static DISCARD in case we're in MULTI mode - * I don't know quite where to put this. :) + * Send a static DISCARD in case we're in MULTI mode. */ -int send_discard_static(RedisSock *redis_sock) { - // Assume failure - int result = FAILURE; +static int send_discard_static(RedisSock *redis_sock) { - // Command, len, and response len + int result = FAILURE; char *cmd, *response; int response_len, cmd_len; - // Format our discard command + /* format our discard command */ cmd_len = redis_cmd_format_static(&cmd, "DISCARD", ""); - // Send our DISCARD command + /* send our DISCARD command */ if (redis_sock_write(redis_sock, cmd, cmd_len TSRMLS_CC) >= 0 && - (response = redis_sock_read(redis_sock, &response_len TSRMLS_CC)) != NULL) - { - // Success if we get OK - result = response_len == 3 && strncmp(response,"+OK", 3) == 0 - ? SUCCESS - : FAILURE; - - // Free our response + (response = redis_sock_read(redis_sock, &response_len TSRMLS_CC)) != NULL) { + + /* success if we get OK */ + result = (response_len == 3 && strncmp(response,"+OK", 3) == 0) ? SUCCESS : FAILURE; + + /* free our response */ efree(response); } - // Free our command + /* free our command */ efree(cmd); - // Return success/failure + /* return success/failure */ return result; } diff --git a/tests/TestRedis.php b/tests/TestRedis.php index a8dfa51c..1033b01c 100644 --- a/tests/TestRedis.php +++ b/tests/TestRedis.php @@ -1032,8 +1032,13 @@ class Redis_Test extends TestSuite $array = array('val', 'val2', 'val3'); - $this->assertEquals($array, $this->redis->sGetMembers('set')); - $this->assertEquals($array, $this->redis->sMembers('set')); // test alias + $sGetMembers = $this->redis->sGetMembers('set'); + sort($sGetMembers); + $this->assertEquals($array, $sGetMembers); + + $sMembers = $this->redis->sMembers('set'); + sort($sMembers); + $this->assertEquals($array, $sMembers); // test alias } public function testlSet() { |