diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-07-18 00:34:56 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-07-18 00:34:56 +0300 |
commit | 3a2583e918bcc805fe860252f8a520fc2f9b26ce (patch) | |
tree | cfe2b7846df4e8c2d1572c6b7b961225a8e87487 /src/goto-commands.c | |
parent | 4794367ce0c31f820bf2bd72d44c886984e3f7ed (diff) | |
download | sciteco-3a2583e918bcc805fe860252f8a520fc2f9b26ce.tar.gz |
fixed minor memory leaks of per-state data in teco_machine_main_t
* These were leaked e.g. in case of end-of-macro errors,
but also in case of syntax highlighting (teco_lexer_style()).
I considered to solve this by overwriting more of the end_of_macro_cb,
but it didn't turn out to be trivial always.
* Considering that the union in teco_machine_main_t saved only 3 machine words
of memory, I decided to sacrifice those for more robust memory management.
* teco_machine_qregspec_t cannot be directly embedded into teco_machine_main_t
due to recursive dependencies with teco_machine_stringbuilding_t.
It could now and should perhaps be allocated only once in teco_machine_main_init(),
but it would require more refactoring.
Diffstat (limited to 'src/goto-commands.c')
-rw-r--r-- | src/goto-commands.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/src/goto-commands.c b/src/goto-commands.c index a0e6634..72be48e 100644 --- a/src/goto-commands.c +++ b/src/goto-commands.c @@ -39,13 +39,6 @@ TECO_DECLARE_STATE(teco_state_eolcomment); teco_string_t teco_goto_skip_label = {NULL, 0}; -static gboolean -teco_state_label_initial(teco_machine_main_t *ctx, GError **error) -{ - memset(&ctx->goto_label, 0, sizeof(ctx->goto_label)); - return TRUE; -} - /* * NOTE: The comma is theoretically not allowed in a label * (see <O> syntax), but is accepted anyway since labels @@ -108,7 +101,6 @@ teco_state_label_input(teco_machine_main_t *ctx, gunichar chr, GError **error) } TECO_DEFINE_STATE(teco_state_label, - .initial_cb = (teco_state_initial_cb_t)teco_state_label_initial, .style = SCE_SCITECO_LABEL ); |