diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-03-01 19:27:55 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-03-01 19:27:55 +0100 |
commit | 0e13d09f89ecb0ce123c8368c8c1fa6f0aa6248d (patch) | |
tree | 8633ba4df020b8e92d1957f5f9876b914de630cd | |
parent | e800d5f8199b860ac8e1b151bf715eb951aeb28f (diff) | |
download | libste-0e13d09f89ecb0ce123c8368c8c1fa6f0aa6248d.tar.gz libste-0e13d09f89ecb0ce123c8368c8c1fa6f0aa6248d.tar.xz libste-0e13d09f89ecb0ce123c8368c8c1fa6f0aa6248d.zip |
stecpy: simplify
-rw-r--r-- | stecpy.c | 11 |
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; |