aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/symbols.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2025-07-26 16:30:17 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2025-07-26 16:48:56 +0300
commit0ea082b74414696a7800455a437656fca2886f6d (patch)
tree63d4809b97c9cbdeb2a2063025fd349af4cd5043 /src/symbols.c
parenteb6f7a82045ad78553fca98c54a51366c55bd7a4 (diff)
downloadsciteco-0ea082b74414696a7800455a437656fca2886f6d.tar.gz
properly document some functions in expressions.c and simplified code
* Practically all calls to teco_expressions_args() must be preceded by teco_expressions_eval(). * In code paths where we know that teco_expressions_args() > 0, it is safe to call teco_expressions_pop_num(0) instead of teco_expressions_pop_num_calc(). This is both easier and faster. * teco_expressions_pop_num_calc() is for simple applications where you just want to get a command argument with default (implied) values. Since it includes teco_expressions_eval(), we can avoid superfluous calls. * -EC...$ turned out to be broken and is fixed now. A test case has been added.
Diffstat (limited to 'src/symbols.c')
-rw-r--r--src/symbols.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/symbols.c b/src/symbols.c
index 4028b7e..b5600e8 100644
--- a/src/symbols.c
+++ b/src/symbols.c
@@ -230,8 +230,6 @@ teco_state_scintilla_symbols_done(teco_machine_main_t *ctx, const teco_string_t
!teco_expressions_eval(FALSE, error))
return NULL;
- teco_int_t value;
-
if (!ctx->scintilla.iMessage) {
if (!teco_expressions_args()) {
g_set_error_literal(error, TECO_ERROR, TECO_ERROR_FAILED,
@@ -239,9 +237,7 @@ teco_state_scintilla_symbols_done(teco_machine_main_t *ctx, const teco_string_t
return NULL;
}
- if (!teco_expressions_pop_num_calc(&value, 0, error))
- return NULL;
- ctx->scintilla.iMessage = value;
+ ctx->scintilla.iMessage = teco_expressions_pop_num(0);
}
return &teco_state_scintilla_lparam;