aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;