Skip to content

Commit

Permalink
re-organize code, init pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Nasreddine Bouafif committed Apr 1, 2010
1 parent 5646f10 commit f4af354
Show file tree
Hide file tree
Showing 6 changed files with 697 additions and 683 deletions.
53 changes: 53 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include "php.h"
#include "php_ini.h"

#define redis_sock_name "Redis Socket Buffer"
#define REDIS_SOCK_STATUS_FAILED 0
#define REDIS_SOCK_STATUS_DISCONNECTED 1
#define REDIS_SOCK_STATUS_UNKNOWN 2
#define REDIS_SOCK_STATUS_CONNECTED 3

#define redis_multi_access_type_name "Redis Multi type access"

/* properties */
#define REDIS_NOT_FOUND 0
#define REDIS_STRING 1
#define REDIS_SET 2
#define REDIS_LIST 3

#define REDIS_ATOMIC 0
#define REDIS_MULTI 1
#define REDIS_PIPELINE 2

#define IF_MULTI() if(get_flag(object) == REDIS_MULTI)
#define IF_PIPELINE() if(get_flag(object) == REDIS_PIPELINE)
#define IF_NOT_MULTI() if(get_flag(object) != REDIS_MULTI)
#define ELSE_IF_MULTI() else {\
if(redis_response_enqueued(redis_sock TSRMLS_CC) == 1) {\
RETURN_ZVAL(getThis(), 1, 0);\
} else {\
RETURN_FALSE;\
}\
}\

#define MULTI_RESPONSE(string, callback) IF_MULTI() { \
fold_item *f1 = malloc(sizeof(fold_item)); \
f1->function_name = strdup(string); \
f1->fun = (void *)callback; \
f1->next = NULL; \
current->next = f1; \
current = f1; \
}\

/* {{{ struct RedisSock */
typedef struct RedisSock_ {
php_stream *stream;
char *host;
unsigned short port;
long timeout;
int failed;
int status;
} RedisSock;
/* }}} */


2 changes: 1 addition & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ if test "$PHP_REDIS" != "no"; then
dnl
dnl PHP_SUBST(REDIS_SHARED_LIBADD)

PHP_NEW_EXTENSION(redis, redis.c, $ext_shared)
PHP_NEW_EXTENSION(redis, redis.c library.c, $ext_shared)
fi
Loading

0 comments on commit f4af354

Please sign in to comment.