summaryrefslogtreecommitdiff
path: root/src/string
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-15 15:43:57 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-15 15:43:57 -0400
commit87d5824b904c5f015f6988d11b04dafda355f9af (patch)
tree161a92b80ced4672d07584533a8982c42499a310 /src/string
parent8396dd0067245b55997ea1ddc20d94be028d50df (diff)
adjust to compile with c89
Diffstat (limited to 'src/string')
-rw-r--r--src/string/memccpy.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/string/memccpy.c b/src/string/memccpy.c
index a6aa6372..b3af75ff 100644
--- a/src/string/memccpy.c
+++ b/src/string/memccpy.c
@@ -2,16 +2,19 @@
void *memccpy(void * restrict s1, const void * restrict s2, int c, size_t n)
{
- //__ASSERT_NOOVERLAP(s1, s2, n);
-
unsigned char *dst = s1;
const unsigned char *src = s2;
- for (size_t i = 0; i < n; i++) {
+ size_t i = 0;
+
+ ASSERT_NOOVERLAP(s1, s2, n);
+
+ for (i = 0; i < n; i++) {
dst[i] = src[i];
if (dst[i] == (unsigned char)c) {
return dst + i + 1;
}
}
+
return NULL;
}