diff options
author | Tom Tromey <tromey@adacore.com> | 2022-10-03 13:51:58 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-10-14 11:21:02 -0600 |
commit | 65558ca5df91470521fda6b0bfdfbbdbd37ce4d3 (patch) | |
tree | 3136e77c0b2c58fe3d0ece1e4bfa4215498605a8 /gdb/cli/cli-script.c | |
parent | ce6c3d253b97961801bc045d10b7fd022578fd03 (diff) | |
download | binutils-65558ca5df91470521fda6b0bfdfbbdbd37ce4d3.zip binutils-65558ca5df91470521fda6b0bfdfbbdbd37ce4d3.tar.gz binutils-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/cli-script.c')
-rw-r--r-- | gdb/cli/cli-script.c | 32 |
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) |