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/help.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/help.c') diff --git a/src/help.c b/src/help.c index b7b5fd0..db8a974 100644 --- a/src/help.c +++ b/src/help.c @@ -92,10 +92,9 @@ teco_help_init(GError **error) teco_help_chunk = g_string_chunk_new(32); rb3_reset_tree(&teco_help_tree); - teco_qreg_t *lib_reg = teco_qreg_table_find(&teco_qreg_table_globals, "$SCITECOPATH", 12); - g_assert(lib_reg != NULL); g_auto(teco_string_t) lib_path = {NULL, 0}; - if (!lib_reg->vtable->get_string(lib_reg, &lib_path.data, &lib_path.len, NULL, error)) + if (!teco_qreg_table_get_string(&teco_qreg_table_globals, "$SCITECOPATH", + &lib_path.data, &lib_path.len, error)) return FALSE; /* * FIXME: lib_path may contain null-bytes. -- cgit v1.2.3