summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-12-11 08:09:30 +0100
committerBardur Arantsson <bardur@scientician.net>2015-12-11 08:09:30 +0100
commit425fce8a89685cb72f97cd173e5724ea3f85398e (patch)
tree3afdfa83b0963df7c515598278ea15a530b50672
parent84908853d4d30b7709f0e70efb59f8c2d094dc1d (diff)
Reduce scope of askfor_aux_complete variable to single file
-rw-r--r--src/cmd3.cc6
-rw-r--r--src/util.cc10
-rw-r--r--src/util.hpp2
3 files changed, 12 insertions, 6 deletions
diff --git a/src/cmd3.cc b/src/cmd3.cc
index d1e569e..59e6171 100644
--- a/src/cmd3.cc
+++ b/src/cmd3.cc
@@ -1943,7 +1943,7 @@ void cli_add(cptr active, cptr trigger, cptr descr)
/*
* Get a string using CLI completion.
*/
-bool_ get_string_cli(cptr prompt, char *buf, int len)
+static bool_ get_string_cli(cptr prompt, char *buf, int len)
{
bool_ res;
@@ -1955,9 +1955,7 @@ bool_ get_string_cli(cptr prompt, char *buf, int len)
prt(prompt, 0, 0);
/* Ask the user for a string */
- askfor_aux_complete = TRUE;
- res = askfor_aux(buf, len);
- askfor_aux_complete = FALSE;
+ res = askfor_aux_with_completion(buf, len);
/* Clear prompt */
prt("", 0, 0);
diff --git a/src/util.cc b/src/util.cc
index 4485396..f2ed1f6 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -2403,7 +2403,8 @@ static int complete_command(char *buf, int clen, int mlen)
* ESCAPE clears the buffer and the window and returns FALSE.
* RETURN accepts the current buffer contents and returns TRUE.
*/
-bool_ askfor_aux_complete = FALSE;
+static bool_ askfor_aux_complete = FALSE;
+
bool_ askfor_aux(char *buf, int len)
{
int y, x;
@@ -2519,6 +2520,13 @@ bool_ askfor_aux(char *buf, int len)
return (TRUE);
}
+bool_ askfor_aux_with_completion(char *buf, int len)
+{
+ askfor_aux_complete = TRUE;
+ bool_ res = askfor_aux(buf, len);
+ askfor_aux_complete = FALSE;
+ return res;
+}
/*
* Get a string from the user
diff --git a/src/util.hpp b/src/util.hpp
index b7c8746..9c6685c 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -47,8 +47,8 @@ extern void text_out(cptr str);
extern void text_out_c(byte a, cptr str);
extern void clear_from(int row);
extern int ask_menu(cptr ask, const std::vector<std::string> &items);
-extern bool_ askfor_aux_complete;
extern bool_ askfor_aux(char *buf, int len);
+extern bool_ askfor_aux_with_completion(char *buf, int len);
extern bool_ get_string(cptr prompt, char *buf, int len);
extern bool_ get_check(cptr prompt);
extern bool_ get_com(cptr prompt, char *command);