From a1dece3df9ccc7676fe7a669de802a5ce4d05cc0 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 8 Nov 2020 15:49:49 -0500 Subject: Use wmemcpy/wmemmove --- edit.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/edit.c b/edit.c index 34b89fe..d9b7673 100644 --- a/edit.c +++ b/edit.c @@ -66,7 +66,7 @@ static struct { static bool reserve(size_t index, size_t count) { if (len + count > Cap) return false; - memmove(&buf[index + count], &buf[index], sizeof(*buf) * (len - index)); + wmemmove(&buf[index + count], &buf[index], len - index); len += count; return true; } @@ -74,12 +74,10 @@ static bool reserve(size_t index, size_t count) { static void delete(bool copy, size_t index, size_t count) { if (index + count > len) return; if (copy) { - memcpy(cut.buf, &buf[index], sizeof(*buf) * count); + wmemcpy(cut.buf, &buf[index], count); cut.len = count; } - memmove( - &buf[index], &buf[index + count], sizeof(*buf) * (len - index - count) - ); + wmemmove(&buf[index], &buf[index + count], len - index - count); len -= count; } @@ -185,7 +183,7 @@ static void tabComplete(uint id) { reserve(tab.pos, tab.len); buf[tab.pos + n] = L' '; } - memcpy(&buf[tab.pos], wcs, sizeof(*wcs) * n); + wmemcpy(&buf[tab.pos], wcs, n); pos = tab.pos + tab.len; } @@ -234,7 +232,7 @@ void edit(uint id, enum Edit op, wchar_t ch) { } break; case EditPaste: { if (reserve(pos, cut.len)) { - memcpy(&buf[pos], cut.buf, sizeof(*buf) * cut.len); + wmemcpy(&buf[pos], cut.buf, cut.len); pos += cut.len; } } -- cgit 1.4.1 e75d0628f74c433c544699dc14bc'/>
path: root/.config/htop (unfollow)
Commit message (Collapse)Author
2016-09-04Simplify colors syntax in zsh promptJune McEnroe
2016-08-29Color rubyStringDelimiter as StringJune McEnroe
2016-08-24Highlight rubyDefine as StructureJune McEnroe
2016-08-23Remove scroll bindings from nvim configJune McEnroe
2016-08-17Highlight Search with black foregroundJune McEnroe
2016-08-15Remove gruvboxJune McEnroe
2016-08-04Remove march from SSH configJune McEnroe
2016-08-01Disable tab indicators in iTermJune McEnroe
2016-07-30Color PreProc DarkGreenJune McEnroe
2016-07-29Color Structure and Typedef in grayJune McEnroe
2016-07-27Color comments DarkBlue and LightBlueJune McEnroe
2016-07-27Color macros in yellowJune McEnroe
2016-07-26Colorscheme colors and schemesJune McEnroe
2016-07-26Add ''subtle'' colorschemeJune McEnroe
I'm just trying this out.
2016-07-26Add htoprcJune McEnroe
2016-07-24Add may and refactor ssh configJune McEnroe
2016-07-18Disable cursorlineJune McEnroe
2016-07-18Use hard constrast gruvbox darkJune McEnroe
2016-07-15Remove vim configurationJune McEnroe
2016-07-15Add readline to README configurations listJune McEnroe
2016-07-15Add vendor script to READMEJune McEnroe
2016-07-15Pull latest pathogen and gruvboxJune McEnroe