Permalink
Browse files

TSRMLS_CC

  • Loading branch information...
1 parent c4fb26e commit 8b1a64b43c52e27de23b4077ec0ab3b246949ebc @michael-grunder michael-grunder committed May 29, 2012
Showing with 20 additions and 21 deletions.
  1. +15 −15 library.c
  2. +4 −5 library.h
  3. +1 −1 redis.c
View
@@ -1374,7 +1374,7 @@ redis_key_prefix(RedisSock *redis_sock, char **key, int *key_len TSRMLS_DC) {
*/
PHPAPI int
-redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size, size_t *line_size) {
+redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size, size_t *line_size TSRMLS_DC) {
// Handle EOF
if(-1 == redis_check_eof(redis_sock TSRMLS_CC)) {
return -1;
@@ -1402,7 +1402,7 @@ redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size, size_t *line_siz
}
PHPAPI int
-redis_read_reply_type(RedisSock *redis_sock, REDIS_REPLY_TYPE *reply_type, int *reply_info) {
+redis_read_reply_type(RedisSock *redis_sock, REDIS_REPLY_TYPE *reply_type, int *reply_info TSRMLS_DC) {
// Make sure we haven't lost the connection, even trying to reconnect
if(-1 == redis_check_eof(redis_sock TSRMLS_CC)) {
// Failure
@@ -1436,13 +1436,13 @@ redis_read_reply_type(RedisSock *redis_sock, REDIS_REPLY_TYPE *reply_type, int *
* Read a single line response, having already consumed the reply-type byte
*/
PHPAPI int
-redis_read_variant_line(RedisSock *redis_sock, REDIS_REPLY_TYPE reply_type, zval **z_ret) {
+redis_read_variant_line(RedisSock *redis_sock, REDIS_REPLY_TYPE reply_type, zval **z_ret TSRMLS_DC) {
// Buffer to read our single line reply
char inbuf[1024];
size_t line_size;
// Attempt to read our single line reply
- if(redis_sock_gets(redis_sock, inbuf, sizeof(inbuf), &line_size) < 0) {
+ if(redis_sock_gets(redis_sock, inbuf, sizeof(inbuf), &line_size TSRMLS_CC) < 0) {
return -1;
}
@@ -1466,9 +1466,9 @@ redis_read_variant_line(RedisSock *redis_sock, REDIS_REPLY_TYPE reply_type, zval
}
PHPAPI int
-redis_read_variant_bulk(RedisSock *redis_sock, int size, zval **z_ret) {
+redis_read_variant_bulk(RedisSock *redis_sock, int size, zval **z_ret TSRMLS_DC) {
// Attempt to read the bulk reply
- char *bulk_resp = redis_sock_read_bulk_reply(redis_sock, size);
+ char *bulk_resp = redis_sock_read_bulk_reply(redis_sock, size TSRMLS_CC);
// Set our reply to FALSE on failure, and the string on success
if(bulk_resp == NULL) {
@@ -1481,15 +1481,15 @@ redis_read_variant_bulk(RedisSock *redis_sock, int size, zval **z_ret) {
}
PHPAPI int
-redis_read_multibulk_recursive(RedisSock *redis_sock, int elements, zval **z_ret) {
+redis_read_multibulk_recursive(RedisSock *redis_sock, int elements, zval **z_ret TSRMLS_DC) {
int reply_info;
REDIS_REPLY_TYPE reply_type;
zval *z_subelem;
// Iterate while we have elements
while(elements > 0) {
// Attempt to read our reply type
- if(redis_read_reply_type(redis_sock, &reply_type, &reply_info) < 0) {
+ if(redis_read_reply_type(redis_sock, &reply_type, &reply_info TSRMLS_CC) < 0) {
zend_throw_exception_ex(redis_exception_ce, 0 TSRMLS_CC, "protocol error, couldn't parse MULTI-BULK response\n", reply_type);
return -1;
}
@@ -1499,7 +1499,7 @@ redis_read_multibulk_recursive(RedisSock *redis_sock, int elements, zval **z_ret
case TYPE_ERR:
case TYPE_LINE:
ALLOC_INIT_ZVAL(z_subelem);
- redis_read_variant_line(redis_sock, reply_type, &z_subelem);
+ redis_read_variant_line(redis_sock, reply_type, &z_subelem TSRMLS_CC);
add_next_index_zval(*z_ret, z_subelem);
break;
case TYPE_INT:
@@ -1509,15 +1509,15 @@ redis_read_multibulk_recursive(RedisSock *redis_sock, int elements, zval **z_ret
case TYPE_BULK:
// Init a zval for our bulk response, read and add it
ALLOC_INIT_ZVAL(z_subelem);
- redis_read_variant_bulk(redis_sock, reply_info, &z_subelem);
+ redis_read_variant_bulk(redis_sock, reply_info, &z_subelem TSRMLS_CC);
add_next_index_zval(*z_ret, z_subelem);
break;
case TYPE_MULTIBULK:
// Construct an array for our sub element, and add it, and recurse
ALLOC_INIT_ZVAL(z_subelem);
array_init(z_subelem);
add_next_index_zval(*z_ret, z_subelem);
- redis_read_multibulk_recursive(redis_sock, reply_info, &z_subelem);
+ redis_read_multibulk_recursive(redis_sock, reply_info, &z_subelem TSRMLS_CC);
break;
}
@@ -1537,7 +1537,7 @@ redis_read_variant_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, zv
zval *z_ret;
// Attempt to read our header
- if(redis_read_reply_type(redis_sock, &reply_type, &reply_info) < 0) {
+ if(redis_read_reply_type(redis_sock, &reply_type, &reply_info TSRMLS_CC) < 0) {
return -1;
}
@@ -1548,21 +1548,21 @@ redis_read_variant_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, zv
switch(reply_type) {
case TYPE_ERR:
case TYPE_LINE:
- redis_read_variant_line(redis_sock, reply_type, &z_ret);
+ redis_read_variant_line(redis_sock, reply_type, &z_ret TSRMLS_CC);
break;
case TYPE_INT:
ZVAL_LONG(z_ret, reply_info);
break;
case TYPE_BULK:
- redis_read_variant_bulk(redis_sock, reply_info, &z_ret);
+ redis_read_variant_bulk(redis_sock, reply_info, &z_ret TSRMLS_CC);
break;
case TYPE_MULTIBULK:
// Initialize an array for our multi-bulk response
array_init(z_ret);
// If we've got more than zero elements, parse our multi bulk respoinse recursively
if(reply_info > -1) {
- redis_read_multibulk_recursive(redis_sock, reply_info, &z_ret);
+ redis_read_multibulk_recursive(redis_sock, reply_info, &z_ret TSRMLS_CC);
}
break;
default:
View
@@ -51,9 +51,8 @@ redis_unserialize(RedisSock *redis_sock, const char *val, int val_len, zval **re
* Variant Read methods, mostly to implement eval
*/
-PHPAPI int redis_read_reply_type(RedisSock *redis_sock, REDIS_REPLY_TYPE *reply_type, int *reply_info);
-PHPAPI int redis_read_reply_type(RedisSock *redis_sock, REDIS_REPLY_TYPE *reply_type, int *reply_info);
-PHPAPI int redis_read_variant_line(RedisSock *redis_sock, REDIS_REPLY_TYPE reply_type, zval **z_ret);
-PHPAPI int redis_read_variant_bulk(RedisSock *redis_sock, int size, zval **z_ret);
-PHPAPI int redis_read_multibulk_recursive(RedisSock *redis_sock, int elements, zval **z_ret);
+PHPAPI int redis_read_reply_type(RedisSock *redis_sock, REDIS_REPLY_TYPE *reply_type, int *reply_info TSRMLS_DC);
+PHPAPI int redis_read_variant_line(RedisSock *redis_sock, REDIS_REPLY_TYPE reply_type, zval **z_ret TSRMLS_DC);
+PHPAPI int redis_read_variant_bulk(RedisSock *redis_sock, int size, zval **z_ret TSRMLS_DC);
+PHPAPI int redis_read_multibulk_recursive(RedisSock *redis_sock, int elements, zval **z_ret TSRMLS_DC);
PHPAPI int redis_read_variant_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, zval *z_tab);
View
@@ -6039,7 +6039,7 @@ PHP_METHOD(Redis, migrate) {
int cmd_len, host_len, key_len, port, dest_db, timeout, key_free;
// Parse arguments
- if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_C, getThis(), "Oslsll", &object, redis_ce,
+ if(zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oslsll", &object, redis_ce,
&host, &host_len, &port, &key, &key_len, &dest_db, &timeout) == FAILURE) {
RETURN_FALSE;
}

0 comments on commit 8b1a64b

Please sign in to comment.