From 9d5a32c536d9adc0e73b95c14199f9266ceed6fe Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 26 Feb 2018 16:47:38 -0500 Subject: [PATCH] Moved assignment from within a loop --- src/rpc/cli.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rpc/cli.cpp b/src/rpc/cli.cpp index 5d7c903..dc63491 100644 --- a/src/rpc/cli.cpp +++ b/src/rpc/cli.cpp @@ -124,9 +124,8 @@ static char *my_rl_complete(char *token, int *match) const char* method_name; auto& cmd = cli_commands(); + int partlen = strlen (token); /* Part of token */ for (auto it : cmd) { - int partlen = strlen (token); /* Part of token */ - if (!strncmp (it.c_str(), token, partlen)) { method_name = it.c_str(); matchlen = partlen;