Diff between cd7eed3370e31662665c2f06f919117b65a8d3bc and 05f0a1531e63833ba96aaac5bc7e40c42fc85326

Changed Files

File Additions Deletions Status
tools/btmgmt.c +7 -6 modified

Full Patch

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index e262350..0686ed6 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -3375,23 +3375,24 @@ static struct cmd_info interactive_cmd[] = {
 
 static char *cmd_generator(const char *text, int state)
 {
-	static int index, len;
+	static int i, j, len;
 	const char *cmd;
 
 	if (!state) {
-		index = 0;
+		i = 0;
+		j = 0;
 		len = strlen(text);
 	}
 
-	while ((cmd = all_cmd[index].cmd)) {
-		index++;
+	while ((cmd = all_cmd[i].cmd)) {
+		i++;
 
 		if (!strncmp(cmd, text, len))
 			return strdup(cmd);
 	}
 
-	while ((cmd = interactive_cmd[index].cmd)) {
-		index++;
+	while ((cmd = interactive_cmd[j].cmd)) {
+		j++;
 
 		if (!strncmp(cmd, text, len))
 			return strdup(cmd);