Module Name: src
Committed By: christos
Date: Mon Oct 15 19:32:48 UTC 2018
Modified Files:
src/common/lib/libc/string: memmem.c
Log Message:
use postincrement, like the patch
XXX: pullup-8
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/string/memmem.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/common/lib/libc/string/memmem.c
diff -u src/common/lib/libc/string/memmem.c:1.2 src/common/lib/libc/string/memmem.c:1.3
--- src/common/lib/libc/string/memmem.c:1.2 Mon Oct 15 14:37:19 2018
+++ src/common/lib/libc/string/memmem.c Mon Oct 15 15:32:48 2018
@@ -25,7 +25,7 @@
#if 0
__FBSDID("$FreeBSD: head/lib/libc/string/memmem.c 315468 2017-03-18 00:53:24Z emaste $");
#else
-__RCSID("$NetBSD: memmem.c,v 1.2 2018/10/15 18:37:19 christos Exp $");
+__RCSID("$NetBSD: memmem.c,v 1.3 2018/10/15 19:32:48 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -40,7 +40,7 @@ static char *twobyte_memmem(const unsign
const unsigned char *n)
{
uint16_t nw = n[0] << 8 | n[1], hw = h[0] << 8 | h[1];
- for (h += 2, k -= 2; k; k--, hw = hw << 8 | *++h)
+ for (h += 2, k -= 2; k; k--, hw = hw << 8 | *h++)
if (hw == nw) return __UNCONST(h - 2);
return hw == nw ? __UNCONST(h - 2) : 0;
}
@@ -50,7 +50,7 @@ static char *threebyte_memmem(const unsi
{
uint32_t nw = n[0] << 24 | n[1] << 16 | n[2] << 8;
uint32_t hw = h[0] << 24 | h[1] << 16 | h[2] << 8;
- for (h += 3, k -= 3; k; k--, hw = (hw|*++h) << 8)
+ for (h += 3, k -= 3; k; k--, hw = (hw|*h++) << 8)
if (hw == nw) return __UNCONST(h - 3);
return hw == nw ? __UNCONST(h - 3) : 0;
}
@@ -60,7 +60,7 @@ static char *fourbyte_memmem(const unsig
{
uint32_t nw = n[0] << 24 | n[1] << 16 | n[2] << 8 | n[3];
uint32_t hw = h[0] << 24 | h[1] << 16 | h[2] << 8 | h[3];
- for (h += 4, k -= 4; k; k--, hw = hw << 8 | *++h)
+ for (h += 4, k -= 4; k; k--, hw = hw << 8 | *h++)
if (hw == nw) return __UNCONST(h - 4);
return hw == nw ? __UNCONST(h - 4) : 0;
return 0;