Skip to content

Commit 8ee4abb

Browse files
yatsukhnenkomichael-grunder
authored andcommitted
Dead code generic_unsubscribe_cmd
1 parent 4ff9bd7 commit 8ee4abb

File tree

2 files changed

+0
-76
lines changed

2 files changed

+0
-76
lines changed

php_redis.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,17 +268,8 @@ typedef void (*ResultCallback)(INTERNAL_FUNCTION_PARAMETERS,
268268

269269
PHP_REDIS_API int redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent);
270270

271-
PHP_REDIS_API void generic_subscribe_cmd(INTERNAL_FUNCTION_PARAMETERS, char *sub_cmd);
272-
273-
PHP_REDIS_API void generic_unsubscribe_cmd(INTERNAL_FUNCTION_PARAMETERS,
274-
char *unsub_cmd);
275-
276271
PHP_REDIS_API int redis_response_enqueued(RedisSock *redis_sock);
277272

278-
PHP_REDIS_API int get_flag(zval *object);
279-
280-
PHP_REDIS_API void set_flag(zval *object, int new_flag);
281-
282273
PHP_REDIS_API int redis_sock_read_multibulk_multi_reply_loop(
283274
INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock, zval *z_tab,
284275
int numElems);

redis.c

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2622,73 +2622,6 @@ PHP_METHOD(Redis, subscribe) {
26222622
* );
26232623
**/
26242624

2625-
PHP_REDIS_API void generic_unsubscribe_cmd(INTERNAL_FUNCTION_PARAMETERS,
2626-
char *unsub_cmd)
2627-
{
2628-
zval *object, *array, *data;
2629-
HashTable *arr_hash;
2630-
RedisSock *redis_sock;
2631-
char *cmd = "", *old_cmd = NULL;
2632-
int cmd_len, array_count;
2633-
2634-
int i;
2635-
zval z_tab, *z_channel;
2636-
2637-
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oa",
2638-
&object, redis_ce, &array) == FAILURE) {
2639-
RETURN_FALSE;
2640-
}
2641-
if ((redis_sock = redis_sock_get(object, 0)) == NULL) {
2642-
RETURN_FALSE;
2643-
}
2644-
2645-
arr_hash = Z_ARRVAL_P(array);
2646-
array_count = zend_hash_num_elements(arr_hash);
2647-
2648-
if (array_count == 0) {
2649-
RETURN_FALSE;
2650-
}
2651-
2652-
ZEND_HASH_FOREACH_VAL(arr_hash, data) {
2653-
ZVAL_DEREF(data);
2654-
if (Z_TYPE_P(data) == IS_STRING) {
2655-
char *old_cmd = NULL;
2656-
if(*cmd) {
2657-
old_cmd = cmd;
2658-
}
2659-
spprintf(&cmd, 0, "%s %s", cmd, Z_STRVAL_P(data));
2660-
if(old_cmd) {
2661-
efree(old_cmd);
2662-
}
2663-
}
2664-
} ZEND_HASH_FOREACH_END();
2665-
2666-
old_cmd = cmd;
2667-
cmd_len = spprintf(&cmd, 0, "%s %s\r\n", unsub_cmd, cmd);
2668-
efree(old_cmd);
2669-
2670-
SOCKET_WRITE_COMMAND(redis_sock, cmd, cmd_len)
2671-
efree(cmd);
2672-
2673-
array_init(return_value);
2674-
for (i = 1; i <= array_count; i++) {
2675-
redis_sock_read_multibulk_reply_zval(
2676-
INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock, &z_tab);
2677-
2678-
if (Z_TYPE(z_tab) == IS_ARRAY) {
2679-
if ((z_channel = zend_hash_index_find(Z_ARRVAL(z_tab), 1)) == NULL) {
2680-
RETURN_FALSE;
2681-
}
2682-
add_assoc_bool(return_value, Z_STRVAL_P(z_channel), 1);
2683-
} else {
2684-
//error
2685-
zval_dtor(&z_tab);
2686-
RETURN_FALSE;
2687-
}
2688-
zval_dtor(&z_tab);
2689-
}
2690-
}
2691-
26922625
PHP_METHOD(Redis, unsubscribe)
26932626
{
26942627
REDIS_PROCESS_KW_CMD("UNSUBSCRIBE", redis_unsubscribe_cmd,

0 commit comments

Comments
 (0)