session OPTIMIZE deleting from an array
Instead of moving all the items after the
deleted one, place only the last one there
instead.
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index 1a4f28b..a33405c 100644
--- a/src/session_server_ssh.c
+++ b/src/session_server_ssh.c
@@ -193,7 +193,7 @@
lydict_remove(server_opts.ctx, ssh_opts.authkeys[i].username);
--ssh_opts.authkey_count;
- memmove(&ssh_opts.authkeys[i], &ssh_opts.authkeys[i + 1], (ssh_opts.authkey_count - i) * sizeof *ssh_opts.authkeys);
+ memcpy(&ssh_opts.authkeys[i], &ssh_opts.authkeys[ssh_opts.authkey_count], sizeof *ssh_opts.authkeys);
ret = 0;
}