Skip to content

Commit

Permalink
Merge branch 'master' into michael-grunder-master
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasff committed Apr 9, 2012
2 parents d717e14 + 80767ee commit 438dbe3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
31 changes: 13 additions & 18 deletions redis.c
Expand Up @@ -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;
}

Expand Down
9 changes: 7 additions & 2 deletions tests/TestRedis.php
Expand Up @@ -1032,8 +1032,13 @@ public function testsGetMembers()

$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() {
Expand Down

0 comments on commit 438dbe3

Please sign in to comment.