summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-11-08 15:49:49 -0500
committerJune McEnroe <june@causal.agency>2020-11-08 16:21:34 -0500
commita1dece3df9ccc7676fe7a669de802a5ce4d05cc0 (patch)
tree75cd029f3c6de58edd4bdef3345bb15f39945c8a
parentRemove static buffer from colorMentions (diff)
downloadcatgirl-a1dece3df9ccc7676fe7a669de802a5ce4d05cc0.tar.gz
catgirl-a1dece3df9ccc7676fe7a669de802a5ce4d05cc0.zip
Use wmemcpy/wmemmove
Diffstat (limited to '')
-rw-r--r--edit.c12
1 files 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;
 			}
 		}
n/title.c?id=279111dda15dd9170e11b9688eb973f2af2e6300&follow=1'>Enable cookies in titleJune McEnroe Perhaps this will make it less suspicious to Google. Who knows. 2019-09-16Use sensitivity aliases in TF2June McEnroe 2019-09-16Add The Just CityJune McEnroe 2019-09-12Only GET the final redirect locationJune McEnroe 2019-09-12Consume entire bodyJune McEnroe Aborting the request and leaving data around may be causing intermittent errors. Just discard the rest of the data. 2019-09-10Add title -v flagJune McEnroe 2019-09-10Use curl error bufferJune McEnroe 2019-09-10Set Accept-Encoding in titleJune McEnroe Because apparently it's fine for servers to respond with Content-Encoding you didn't ask for, and curl won't decode it if you didn't ask for it. 2019-09-08Set title User-AgentJune McEnroe Some things don't like you if you don't send one. 2019-09-07Add -x flag to titleJune McEnroe 2019-09-07Ignore SIGPIPE in relayJune McEnroe Allows restarting consumers safely. 2019-09-07Add A Memory Called EmpireJune McEnroe 2019-09-05Handle lack of Content-TypeJune McEnroe 2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe Oops, didn't see this. 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe