Permalink
Browse files

re-organize code, init pipeline

  • Loading branch information...
1 parent 5646f10 commit f4af354475b27b4aedf465c3c6442138d87a7d3c Nasreddine Bouafif committed Apr 1, 2010
Showing with 697 additions and 683 deletions.
  1. +53 −0 common.h
  2. +1 −1 config.m4
  3. +502 −0 library.c
  4. +22 −0 library.h
  5. +2 −56 php_redis.h
  6. +117 −626 redis.c
View
@@ -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;
+/* }}} */
+
+
View
@@ -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
Oops, something went wrong.

0 comments on commit f4af354

Please sign in to comment.