MIGRATE: Remove upfront ttl initialization.
After the fix for #3673 the ttl var is always initialized inside the loop itself, so the early initialization is not needed. Variables declaration also moved to a more local scope.
This commit is contained in:
parent
c9f0456d81
commit
b53e73e159
@ -4750,7 +4750,6 @@ void migrateCommand(client *c) {
|
|||||||
int copy, replace, j;
|
int copy, replace, j;
|
||||||
long timeout;
|
long timeout;
|
||||||
long dbid;
|
long dbid;
|
||||||
long long ttl, expireat;
|
|
||||||
robj **ov = NULL; /* Objects to migrate. */
|
robj **ov = NULL; /* Objects to migrate. */
|
||||||
robj **kv = NULL; /* Key names. */
|
robj **kv = NULL; /* Key names. */
|
||||||
robj **newargv = NULL; /* Used to rewrite the command as DEL ... keys ... */
|
robj **newargv = NULL; /* Used to rewrite the command as DEL ... keys ... */
|
||||||
@ -4765,7 +4764,6 @@ void migrateCommand(client *c) {
|
|||||||
/* Initialization */
|
/* Initialization */
|
||||||
copy = 0;
|
copy = 0;
|
||||||
replace = 0;
|
replace = 0;
|
||||||
ttl = 0;
|
|
||||||
|
|
||||||
/* Parse additional options */
|
/* Parse additional options */
|
||||||
for (j = 6; j < c->argc; j++) {
|
for (j = 6; j < c->argc; j++) {
|
||||||
@ -4841,8 +4839,9 @@ try_again:
|
|||||||
|
|
||||||
/* Create RESTORE payload and generate the protocol to call the command. */
|
/* Create RESTORE payload and generate the protocol to call the command. */
|
||||||
for (j = 0; j < num_keys; j++) {
|
for (j = 0; j < num_keys; j++) {
|
||||||
ttl = 0;
|
long long ttl = 0;
|
||||||
expireat = getExpire(c->db,kv[j]);
|
long long expireat = getExpire(c->db,kv[j]);
|
||||||
|
|
||||||
if (expireat != -1) {
|
if (expireat != -1) {
|
||||||
ttl = expireat-mstime();
|
ttl = expireat-mstime();
|
||||||
if (ttl < 1) ttl = 1;
|
if (ttl < 1) ttl = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user