Migrate table-based for-loops to key-value iteration

This commit is contained in:
Jon Siwek 2019-03-15 19:45:48 -07:00
parent 41c7b229d3
commit 01d303b480
36 changed files with 150 additions and 153 deletions

View file

@ -37,10 +37,10 @@ function describe_file(f: fa_file): string
if ( f$source != "FTP" )
return "";
for ( cid in f$conns )
for ( cid, c in f$conns )
{
if ( f$conns[cid]?$ftp )
return FTP::describe(f$conns[cid]$ftp);
if ( c?$ftp )
return FTP::describe(c$ftp);
}
return "";
}

View file

@ -295,9 +295,9 @@ event connection_state_remove(c: connection) &priority=-5
{
if ( ! c?$ftp ) return;
for ( ca in c$ftp$pending_commands )
for ( ca, cmdarg in c$ftp$pending_commands )
{
c$ftp$cmdarg = c$ftp$pending_commands[ca];
c$ftp$cmdarg = cmdarg;
ftp_message(c$ftp);
}
}

View file

@ -91,9 +91,8 @@ function get_pending_cmd(pc: PendingCmds, reply_code: count, reply_msg: string):
local best_seq = 0;
local best_score: int = -1;
for ( cmd_seq in pc )
for ( cmd_seq, cmd in pc )
{
local cmd = pc[cmd_seq];
local score: int = 0;
# if the command is compatible with the reply code