aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/move-commands.c
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2025-12-28 16:23:22 +0100
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2025-12-28 20:57:31 +0100
commitea0a23645f03a42252ab1ce8df45ae4076ebae75 (patch)
tree5fe606a9b07f2f7039b1839f9fac6bab2d212c13 /src/move-commands.c
parentd94521fb5b5a5c3a6315c425dba5f1218f0dd323 (diff)
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.
Diffstat (limited to 'src/move-commands.c')
-rw-r--r--src/move-commands.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/move-commands.c b/src/move-commands.c
index cf5d6b0..57007b6 100644
--- a/src/move-commands.c
+++ b/src/move-commands.c
@@ -276,7 +276,7 @@ teco_find_words(gsize *pos, teco_int_t n, gboolean end_of_word)
/*
* FIXME: Is this safe or do we have to look up Unicode code points?
*/
- if ((!teco_string_contains(&wchars, *p)) == skip_word) {
+ if ((!teco_string_contains(wchars, *p)) == skip_word) {
if (skip_word == end_of_word)
break;
skip_word = !skip_word;
@@ -314,7 +314,7 @@ teco_find_words(gsize *pos, teco_int_t n, gboolean end_of_word)
/*
* FIXME: Is this safe or do we have to look up Unicode code points?
*/
- if ((!teco_string_contains(&wchars, p[-1])) == skip_word) {
+ if ((!teco_string_contains(wchars, p[-1])) == skip_word) {
if (skip_word != end_of_word)
break;
skip_word = !skip_word;