about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-03-01 19:27:55 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-03-01 19:27:55 +0100
commit0e13d09f89ecb0ce123c8368c8c1fa6f0aa6248d (patch)
tree8633ba4df020b8e92d1957f5f9876b914de630cd
parente800d5f8199b860ac8e1b151bf715eb951aeb28f (diff)
downloadlibste-0e13d09f89ecb0ce123c8368c8c1fa6f0aa6248d.tar.gz
libste-0e13d09f89ecb0ce123c8368c8c1fa6f0aa6248d.tar.xz
libste-0e13d09f89ecb0ce123c8368c8c1fa6f0aa6248d.zip
stecpy: simplify
-rw-r--r--stecpy.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/stecpy.c b/stecpy.c
index ac521ab..2fec72d 100644
--- a/stecpy.c
+++ b/stecpy.c
@@ -1,14 +1,11 @@
-#include <stddef.h>
-
 char *
 stecpy(char *dst, char *end, const char *src)
 {
-        if (dst >= end)
-                return dst;
+	if (dst >= end)
+		return dst;
 
-	size_t n = end - dst;
-	while (n && (*dst = *src))
-		n--, src++, dst++;
+	while (dst < end && (*dst = *src))
+		src++, dst++;
 
 	if (dst == end)
 		dst[-1] = 0;