Skip to content

Commit 65e5798

Browse files
committed
REDIS_PROCESS_RESPONSE_CLOSURE
1 parent fc2453c commit 65e5798

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

common.h

+16-23
Original file line numberDiff line numberDiff line change
@@ -509,21 +509,6 @@ typedef enum _PUBSUB_TYPE {
509509
} \
510510
} while (0)
511511

512-
#define REDIS_ELSE_IF_MULTI(function, closure_context) \
513-
else IF_MULTI() { \
514-
if (redis_response_enqueued(redis_sock TSRMLS_CC) != SUCCESS) { \
515-
RETURN_FALSE; \
516-
} \
517-
REDIS_SAVE_CALLBACK(function, closure_context); \
518-
RETURN_ZVAL(getThis(), 1, 0);\
519-
}
520-
521-
#define REDIS_ELSE_IF_PIPELINE(function, closure_context) \
522-
else IF_PIPELINE() { \
523-
REDIS_SAVE_CALLBACK(function, closure_context); \
524-
RETURN_ZVAL(getThis(), 1, 0); \
525-
}
526-
527512
#define REDIS_PROCESS_REQUEST(redis_sock, cmd, cmd_len) \
528513
IF_PIPELINE() { \
529514
PIPELINE_ENQUEUE_COMMAND(cmd, cmd_len); \
@@ -533,11 +518,17 @@ typedef enum _PUBSUB_TYPE {
533518
efree(cmd);
534519

535520
#define REDIS_PROCESS_RESPONSE_CLOSURE(function, closure_context) \
536-
REDIS_ELSE_IF_MULTI(function, closure_context) \
537-
REDIS_ELSE_IF_PIPELINE(function, closure_context);
521+
IF_MULTI() { \
522+
if (redis_response_enqueued(redis_sock TSRMLS_CC) != SUCCESS) { \
523+
RETURN_FALSE; \
524+
} \
525+
} \
526+
REDIS_SAVE_CALLBACK(function, closure_context); \
527+
RETURN_ZVAL(getThis(), 1, 0); \
538528

539-
#define REDIS_PROCESS_RESPONSE(function) \
540-
REDIS_PROCESS_RESPONSE_CLOSURE(function, NULL)
529+
#define REDIS_PROCESS_RESPONSE(function) else { \
530+
REDIS_PROCESS_RESPONSE_CLOSURE(function, NULL) \
531+
}
541532

542533
/* Clear redirection info */
543534
#define REDIS_MOVED_CLEAR(redis_sock) \
@@ -557,8 +548,9 @@ typedef enum _PUBSUB_TYPE {
557548
REDIS_PROCESS_REQUEST(redis_sock, cmd, cmd_len); \
558549
IF_ATOMIC() { \
559550
resp_func(INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock, NULL, ctx); \
560-
} \
561-
REDIS_PROCESS_RESPONSE_CLOSURE(resp_func,ctx);
551+
} else { \
552+
REDIS_PROCESS_RESPONSE_CLOSURE(resp_func, ctx) \
553+
}
562554

563555
/* Process a command but with a specific command building function
564556
* and keyword which is passed to us*/
@@ -572,8 +564,9 @@ typedef enum _PUBSUB_TYPE {
572564
REDIS_PROCESS_REQUEST(redis_sock, cmd, cmd_len); \
573565
IF_ATOMIC() { \
574566
resp_func(INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock, NULL, ctx); \
575-
} \
576-
REDIS_PROCESS_RESPONSE_CLOSURE(resp_func,ctx);
567+
} else { \
568+
REDIS_PROCESS_RESPONSE_CLOSURE(resp_func, ctx) \
569+
}
577570

578571
#define REDIS_STREAM_CLOSE_MARK_FAILED(redis_sock) \
579572
redis_stream_close(redis_sock TSRMLS_CC); \

0 commit comments

Comments
 (0)