aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-10-03 13:51:58 -0600
committerTom Tromey <tromey@adacore.com>2022-10-14 11:21:02 -0600
commit65558ca5df91470521fda6b0bfdfbbdbd37ce4d3 (patch)
tree3136e77c0b2c58fe3d0ece1e4bfa4215498605a8 /gdb/cli
parentce6c3d253b97961801bc045d10b7fd022578fd03 (diff)
downloadgdb-65558ca5df91470521fda6b0bfdfbbdbd37ce4d3.zip
gdb-65558ca5df91470521fda6b0bfdfbbdbd37ce4d3.tar.gz
gdb-65558ca5df91470521fda6b0bfdfbbdbd37ce4d3.tar.bz2
Use scoped_value_mark in more places
I looked at all the spots using value_mark, and converted all the straightforward ones to use scoped_value_mark instead. Regression tested on x86-64 Fedora 34.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-script.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 6c67b60..22e3efa 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -512,8 +512,6 @@ static enum command_control_type
execute_control_command_1 (struct command_line *cmd, int from_tty)
{
struct command_line *current;
- struct value *val;
- struct value *val_mark;
int loop;
enum command_control_type ret;
@@ -567,10 +565,11 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
QUIT;
/* Evaluate the expression. */
- val_mark = value_mark ();
- val = evaluate_expression (expr.get ());
- cond_result = value_true (val);
- value_free_to_mark (val_mark);
+ {
+ scoped_value_mark mark;
+ value *val = evaluate_expression (expr.get ());
+ cond_result = value_true (val);
+ }
/* If the value is false, then break out of the loop. */
if (!cond_result)
@@ -621,16 +620,17 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
ret = simple_control;
/* Evaluate the conditional. */
- val_mark = value_mark ();
- val = evaluate_expression (expr.get ());
-
- /* Choose which arm to take commands from based on the value
- of the conditional expression. */
- if (value_true (val))
- current = cmd->body_list_0.get ();
- else if (cmd->body_list_1 != nullptr)
- current = cmd->body_list_1.get ();
- value_free_to_mark (val_mark);
+ {
+ scoped_value_mark mark;
+ value *val = evaluate_expression (expr.get ());
+
+ /* Choose which arm to take commands from based on the value
+ of the conditional expression. */
+ if (value_true (val))
+ current = cmd->body_list_0.get ();
+ else if (cmd->body_list_1 != nullptr)
+ current = cmd->body_list_1.get ();
+ }
/* Execute commands in the given arm. */
while (current)