Skip to content

Commit d1d5a31

Browse files
Remove unused code, properly return eval command length
1 parent d18388b commit d1d5a31

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

redis.c

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5429,7 +5429,7 @@ PHP_METHOD(Redis, object)
54295429
RedisSock *redis_sock;
54305430
char *cmd = "", *info = NULL, *key = NULL;
54315431
int cmd_len, info_len, key_len;
5432-
long port = 6379;
5432+
//long port = 6379;
54335433

54345434
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss",
54355435
&object, redis_ce, &info, &info_len, &key, &key_len) == FAILURE) {
@@ -5672,6 +5672,8 @@ redis_build_eval_cmd(RedisSock *redis_sock, char **ret, char *keyword, char *val
56725672
cmd_len = redis_cmd_format_static(ret, keyword, "sd", value, val_len, 0);
56735673
}
56745674

5675+
// Return our command length
5676+
return cmd_len;
56755677
}
56765678

56775679
/* {{{ proto variant Redis::evalsha(string script_sha1, [array keys, int num_key_args])
@@ -5737,25 +5739,6 @@ PHP_METHOD(Redis, eval)
57375739
REDIS_PROCESS_RESPONSE(redis_read_variant_reply);
57385740
}
57395741

5740-
// Validate that we've been provided a proper SCRIPT sub command
5741-
PHPAPI int
5742-
validate_script_directive(char *directive) {
5743-
// Valid SCRIPT sub commands
5744-
char **valid_cmds = {"flush", "kill", "load", "exists"};
5745-
int cmd_count = 4, i;
5746-
5747-
// Iterate our valid commands
5748-
for(i=0;i<cmd_count;i++) {
5749-
// If we found a match, return success
5750-
if(!strcasecmp(directive, valid_cmds[i])) {
5751-
return 0;
5752-
}
5753-
}
5754-
5755-
// Return failure
5756-
return -1;
5757-
}
5758-
57595742
PHPAPI int
57605743
redis_build_script_exists_cmd(char **ret, zval **argv, int argc) {
57615744
// Our command length and iterator
@@ -5786,7 +5769,7 @@ redis_build_script_exists_cmd(char **ret, zval **argv, int argc) {
57865769
* {{{ proto int Reids::script('exists', script_sha1 [, script_sha2, ...])
57875770
*/
57885771
PHP_METHOD(Redis, script) {
5789-
zval *object, **z_args;
5772+
zval **z_args;
57905773
RedisSock *redis_sock;
57915774
int cmd_len, argc;
57925775
char *cmd;

0 commit comments

Comments
 (0)