From ea0a23645f03a42252ab1ce8df45ae4076ebae75 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 28 Dec 2025 16:23:22 +0100 Subject: teco_string_t is now passed by value like a scalar if the callee isn't expected to modify it * When passing a struct that should not be modified, I usually use a const pointer. * Strings however are small 2-word objects and they are often now already passed via separate `gchar*` and gsize parameters. So it is consistent to pass teco_string_t by value as well. A teco_string_t will usually fit into registers just like a pointer. * It's now obvious which function just _uses_ and which function _modifies_ a string. There is also no chance to pass a NULL pointer to those functions. --- src/interface-curses/curses-info-popup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/interface-curses/curses-info-popup.c') diff --git a/src/interface-curses/curses-info-popup.c b/src/interface-curses/curses-info-popup.c index 8da6fbb..825555e 100644 --- a/src/interface-curses/curses-info-popup.c +++ b/src/interface-curses/curses-info-popup.c @@ -133,7 +133,7 @@ teco_curses_info_popup_init_pad(teco_curses_info_popup_t *ctx, attr_t attr) switch (entry->type) { case TECO_POPUP_FILE: - g_assert(!teco_string_contains(&name, '\0')); + g_assert(!teco_string_contains(name, '\0')); if (teco_ed & TECO_ED_ICONS) { /* "(Unnamed)" buffer is looked up as "" */ teco_curses_add_wc(ctx->pad, teco_curses_icons_lookup_file(entry->name.data)); @@ -142,7 +142,7 @@ teco_curses_info_popup_init_pad(teco_curses_info_popup_t *ctx, attr_t attr) teco_curses_format_filename(ctx->pad, name.data, -1); break; case TECO_POPUP_DIRECTORY: - g_assert(!teco_string_contains(&name, '\0')); + g_assert(!teco_string_contains(name, '\0')); if (teco_ed & TECO_ED_ICONS) { teco_curses_add_wc(ctx->pad, teco_curses_icons_lookup_dir(entry->name.data)); waddch(ctx->pad, ' '); -- cgit v1.2.3