From 32122651bdb51006edce2be3586dd09179bed52f Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 23 Aug 2026 00:28:23 +0200 Subject: introduced helper functions teco_qreg_table_get_string() and teco_qreg_table_get_integer() * Simplifies the common task of querying an integer or string from a Q-Register table. * Undefined Q-Regs are reported as TECO_ERROR_QREGUNDEF, so you can theoretically handle this case. In practice however, it requires less boilerplating to just call teco_qreg_table_find() manually. * It also doesn't make sense to use these functions when getting and setting a register at the same time as you will want to avoid repeated lookups. --- src/interface-gtk/interface.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/interface-gtk/interface.c') diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 1f6259f..b2d4788 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -1210,11 +1210,9 @@ teco_interface_handle_scroll(GdkEventScroll *event, GError **error) gboolean teco_interface_event_loop(GError **error) { - teco_qreg_t *scitecoconfig_reg = teco_qreg_table_find(&teco_qreg_table_globals, "$SCITECOCONFIG", 14); - g_assert(scitecoconfig_reg != NULL); g_auto(teco_string_t) scitecoconfig = {NULL, 0}; - if (!scitecoconfig_reg->vtable->get_string(scitecoconfig_reg, - &scitecoconfig.data, &scitecoconfig.len, NULL, error)) + if (!teco_qreg_table_get_string(&teco_qreg_table_globals, "$SCITECOCONFIG", + &scitecoconfig.data, &scitecoconfig.len, error)) return FALSE; if (teco_string_contains(scitecoconfig, '\0')) { g_set_error_literal(error, TECO_ERROR, TECO_ERROR_FAILED, -- cgit v1.2.3