From 44cbc4c19ccee2d624620af4193338ff4e278a66 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Fri, 21 Feb 2020 23:30:54 +0100 Subject: [PATCH] Use g_string_erase instead of memmove. The memmove moved queued keys toward the beginning and left clutter and unwanted stuff at the end which might cause issues in future. So now g_string_erase is used which strips chars from the beginning of the string. This is what the memmove() intended but did not make obvious. --- src/map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/map.c b/src/map.c index ed5e599..72d364e 100644 --- a/src/map.c +++ b/src/map.c @@ -170,7 +170,7 @@ MapState map_handle_keys(Client *c, const guchar *keys, int keylen, gboolean use c->map.resolved -= 3; c->map.qlen -= 3; /* move all other queue entries three steps to the left */ - memmove(c->map.queue->str, c->map.queue->str + 3, c->map.qlen); + g_string_erase(c->map.queue, 0, 3); } else { /* get first char of queue */ qk = c->map.queue->str[0]; @@ -179,7 +179,7 @@ MapState map_handle_keys(Client *c, const guchar *keys, int keylen, gboolean use c->map.qlen--; /* move all other queue entries one step to the left */ - memmove(c->map.queue->str, c->map.queue->str + 1, c->map.qlen); + g_string_erase(c->map.queue, 0, 1); } /* remove the no-map flag */ -- 2.20.1