Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2021-02-25 21:03:53 +0300
committerGitHub <noreply@github.com>2021-02-25 21:03:53 +0300
commite61ee1da45e2c20d8d10c1802d47cfbea4c66b14 (patch)
tree093c9db771bd9ea08207ca3f20601ae36677eebb /common.h
parent1f2a7ef6b5ea9c032e6075b2c21e0cf57bd11c3f (diff)
Normalize Redis callback prototypes and stop typecasting. (#1935)
Diffstat (limited to 'common.h')
-rw-r--r--common.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/common.h b/common.h
index b84f60a7..fd11bf4e 100644
--- a/common.h
+++ b/common.h
@@ -139,7 +139,7 @@ typedef enum {
#define REDIS_SAVE_CALLBACK(callback, closure_context) do { \
fold_item *fi = malloc(sizeof(fold_item)); \
- fi->fun = (void *)callback; \
+ fi->fun = callback; \
fi->ctx = closure_context; \
fi->next = NULL; \
if (redis_sock->current) { \
@@ -194,7 +194,7 @@ typedef enum {
REDIS_PROCESS_RESPONSE_CLOSURE(resp_func, ctx) \
}
-/* Process a command but with a specific command building function
+/* Process a command but with a specific command building function
* and keyword which is passed to us*/
#define REDIS_PROCESS_KW_CMD(kw, cmdfunc, resp_func) \
RedisSock *redis_sock; char *cmd; int cmd_len; void *ctx=NULL; \
@@ -255,12 +255,6 @@ typedef enum {
#endif
#endif
-typedef struct fold_item {
- zval * (*fun)(INTERNAL_FUNCTION_PARAMETERS, void *, ...);
- void *ctx;
- struct fold_item *next;
-} fold_item;
-
/* {{{ struct RedisSock */
typedef struct {
php_stream *stream;
@@ -285,8 +279,8 @@ typedef struct {
zend_string *prefix;
short mode;
- fold_item *head;
- fold_item *current;
+ struct fold_item *head;
+ struct fold_item *current;
zend_string *pipeline_cmd;
@@ -301,6 +295,16 @@ typedef struct {
} RedisSock;
/* }}} */
+/* Redis response handler function callback prototype */
+typedef void (*ResultCallback)(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, zval *z_tab, void *ctx);
+typedef int (*FailableResultCallback)(INTERNAL_FUNCTION_PARAMETERS, RedisSock*, zval*, void*);
+
+typedef struct fold_item {
+ FailableResultCallback fun;
+ void *ctx;
+ struct fold_item *next;
+} fold_item;
+
typedef struct {
zend_llist list;
int nb_active;